2 ms·
I'm happy to assert that making anything other than false be false is a mistake. The problem is sum types. Specifically, languages which "don't have" sum types
by tialaramex 4y ago
I'm happy to assert that making anything other than false be false is a mistake.
The problem is sum types. Specifically, languages which "don't have" sum types often secretly do have sum types, absolutely everywhere, but no language facilities to deal with them because they "don't have" sum types. That's what the billion dollar mistake is, it's sum types (thing | NULL) with no language facilities. In Python that's (thing | None) but the same penalty accrues.
Now, PEP 505 introduces a bunch of actual language facilities. They might be a good idea for Python, other languages successfully did this, but I think as a lesson going forward what we should take away is that we do want Sum types and we should stop pretending we (sometimes?) don't, which means new languages need to be designed for them.
- Tainnor 4y agoIt seems like most more modern languages actually have facilities for expressing proper sum types (even if it is in some languages more verbose than in others). Certainly Kotlin, Swift, Rust, etc. do have them. Even Java, I believe, is planning to add them, though I suspect that many people won't necessarily understand why they're useful even when they land. It's probably helped by functional programming becoming more mainstream and "obvious" sum types needing to be implemented (Optional and Result, mostly).