3 ms·
Functional programming languages have been doing it for ages. Most "newer" statically typed languages also have it (Swift, Kotlin, Rust) by default. And old lan
by augusto2112 7y ago
Functional programming languages have been doing it for ages. Most "newer" statically typed languages also have it (Swift, Kotlin, Rust) by default. And old languages had it bolted on (C# 8, Java 8, C++ 17).
I think at this point basically everyone has realized null by default is a terrible idea.
- masklinn 7y ago> And old languages had it bolted on (C# 8, Java 8, C++ 17). C#: actually true, you can switch over to non-nullable reference types Java 8: meeeh, it provides an Optional but all references are still nullable, including references to Optional. There are also @Nullable and @NotNull annotations but they're also meh, plus some checkers handle them oddly[0] C++17: you can deref' an std::optional, it's completely legal, and it's an UB if the optional is empty. Despite its name, std::optional is not a type-safety feature, its goal is not to provide for "nullable references" (that's a pointer), it's to provide a stack-allocated smart pointer (rather than have to allocate with unique_ptr for instance). [0] https://checkerframework.org/manual/#findbugs-nullable https://checkerframework.org/manual/#findbugs-nullable