@rocx If it's built in to the language and pervasively used, I'd consider Optional<T> to include the null value. However, optional types prevent the mistake, since the compiler checks ☺️
miniblog.
Related Posts
Playing with optional type signatures in Python, I realise that the return type is the most important to me.
I'd much rather have a function with only a return type instead of a function with only parameter types. It's often quick to add too.
Coming from JS or Python, imports in Rust feel weird. They're entirely optional aliases for fully qualified symbols, which are always available.
I don't know of many other languages where you can just start using libraries. Java is the only one I can think of.
TypeScript has a really neat way of changing the required-ness of fields in objects.
Partial<Foo> is the same shape as Foo, but all the fields are optional. Required<Foo> is the same shape as foo but all the fields are required.