DEV Community

Discussion on: NULL, "The Billion Dollar Mistake", Maybe Just Nothing

Collapse
 
kspeakman profile image
Kasey Speakman • Edited

Thanks for the post!

Very minor pedantic point about .NET Nullable. The current version of Nullable<T> can only be used with value types. Specifying string? will not compile. It basically lets value types (int, float, etc.) be null. Without this, they just map to byte values on the stack, not memory locations, so they can be zero but not null. This would not map very well to database columns such as int null.

However, nowadays a lot of devs have seen the value in assuming types are not null unless they are explicitly marked as having null as a valid value. So there is an effort underway to bring nullable reference types to C#. Another .NET language is F#. Since it was based on OCaml, it has had the Option type to represent any kind of object as explicitly "nullable" for a while.

Cheers!

Collapse
 
joelnet profile image
JavaScript Joel

That's a lot of great info. It would be nice to have Option as an Option!