Hacker News new | ask | show | jobs
by estimator7292 300 days ago
Truthfully I think the language lost something critically important when we went gung-ho on purging ourselves of the EVILS! of nullable types.

Back in the Paleolithic, the only way to get a nullable value type was to extremely explicitly box it into a Nullable<T>. The distinction between value and reference types was crystal clear and unmistakable. Boxing values required an active and deliberate decision.

Now I guess we just box everything because null checks are hard or something.

1 comments

C# doesn't box value types and can be treated like an object semantically for things like generics.

IMO, we should just do away with nullability and use the optional/maybe approach as wrappers for potential values. Null shouldn't really exist ideally, especially in OO because it is a unit value and also the parent value for all objects. I appreciate nullability being introduced but it causes a fork in types by two branches at the top of the hierarchy in most cases and more conceptually just associates these optionals with this flawed concept.