4 ms·
I'd agree; if I had to guess what's most likely to become mainstream soon, it would be union types with matching (like Either or Result types). Strange that Go
by blandflakes 6y ago
I'd agree; if I had to guess what's most likely to become mainstream soon, it would be union types with matching (like Either or Result types). Strange that Go did the lazy thing and made the type signature a tuple, requiring you to match yourself...
- saagarjha 6y agoGo explicitly eschews more advanced features in its type system–it not being "lazy", it thinks that such things are too complicated to be in the language. Most other up-and-coming languages have chosen to include proper sum types, including Swift and Rust.
- mumblemumble 6y ago> it thinks that such things are too complicated to be in the language. Yep. Though, there are two ways to interpret that statement. One of the things that has always slightly annoyed me about Go's messaging is that it conflates "complicated for the language's implementers" and "complicated for the language's users." To the point where it sometimes verges on being a sort of mild gaslighting.
- saagarjha 6y agoI personally find languages that treat their users as stupid (providing facilities to the language designers but not its users) to be infuriating. Go is pretty much the paragon of this philosophy.
- mumblemumble 6y agoI'm not even sure that the intent is to treat users as stupid. It seems just as likely that it's just a collective experiment in elevating sour grapes into an art form.
- blandflakes 6y agoYour more charitable characterization is certainly reasonable, but I find that pushing the complexity of matching the cases to the users (including the IMO invalid state of "returned a value AND an error") just results in a below-MVP error system.