3 ms·
Looks exactly like adding the ?? [1] and ?. [2] operators from C#. [1]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/null-coales
by hnra 8y ago
Looks exactly like adding the ?? [1] and ?. [2] operators from C#.
[1]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/null-coalescing-operator https://docs.microsoft.com/en-us/dotnet/csharp/language-refe...
[2]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/null-conditional-operators https://docs.microsoft.com/en-us/dotnet/csharp/language-refe...
- gaius 8y agooperators from C# Why not go the whole hog then, and do a Option[1] ;-) [1] https://en.wikipedia.org/wiki/Option_type#F# https://en.wikipedia.org/wiki/Option_type#F#
- mmirate 8y agoOption is bubkes if the language itself still has the billion-dollar mistake; that's why F# and Scala are far less practical than OCaml. Python also has it with "None" (though since it is dynamically typed, it's arguable that from the perspective of any given type, every value of every other type is a fresh instance of the billion-dollar mistake). And sadly, removing None from Python and replacing it by Option - let alone removing Exception and letting Result (aka Either) take its rightful place - would cause huge amount of Python code to need rewriting. And it wouldn't even be worth it because of dynamic typing.
- marcosdumay 8y agoWhat does you gain from optionals if you can't determine types at compile time?
- dragonwriter 8y ago> What does you gain from optionals if you can't determine types at compile time? As well as type checking (which is relevant because Python has AOT checkers even if they are optional), Options, compared to bills, give you nestability, which is a runtime advantage not dependent on static type checking.