|
|
|
|
|
by gwbas1c
2022 days ago
|
|
That's why I laugh when I see that a language "doesn't have null." It's more like newer languages make it hard to accidentally have a null reference error. Nullable versus Option just seems like a semantics argument. The discussion makes sense when designing a language, but when choosing a language, it's more important to just look for "compiler makes it possible to enforce that a value isn't null." BTW: In Rust, calling unwrap() on an Option can panic. It's just that the compiler will prevent you from passing None to a function that expects a value. C# has nullable scalars: (int? char? float?, ect.) They compile to a Nullable<T> struct, so you can do a lot of generalizing like you can with Option<T>. |
|