Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"Decent" is being very kind to any language that has a type system where every reference type is implicitly a Maybe (okay, Scala exists).


Go and Scala also allow every pointer to be null, no? Scala has an option type, but so does Java 8. Defining one in C# is easy.

But there is Ceylon, Kotlin, Clojure, whatever. Kotlin uses ? suffixes to define if something is optional. And at least the code interops nicely. You can inherit a huge Java codebase and slowly convert the code over. No such luck with Go. Unless you're converting into C!


C# and Java optionals aren't very useful, since they would be reference types themselves, and thus could be null!

I would submit Rust and Swift as "decent" type systems, if Haskell is the standard for "good". They do nullability correctly, but lack HKTs.


C# has non-nullable value types via the `struct` keyword. And C# in fact already has a defined optional type to handle this; it's called `Nullable`. [0]

[0] https://msdn.microsoft.com/en-us/library/b3h38hb0%28v=vs.110...


In Scala, Option[Whatever] may also be null. The difference is that it's considered "some Java compatibility leftover" and never exploited by any sane piece of code.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: