3 ms·
Same here, go would be such a killer language if it just had sum types.
by the_gipsy 4y ago
Same here, go would be such a killer language if it just had sum types.
- kaba0 4y agoYeah, it might even reach Java 1.1, feature-wise then.
- the_gipsy 4y agoJava does not have sum types.
- kaba0 4y agoIt didn’t have at 1.1, but it does now: https://news.ycombinator.com/item?id=35133670 https://news.ycombinator.com/item?id=35133670
- the_gipsy 4y agoYou can do that with go too, there are libraries out there. But it's all a joke compared to real support in the language.
- kaba0 4y agoReal support like what Java has? It literally has sealed classes and interfaces that specify all the possible classes that can subtype it. This is enforced by the language and allows for things like exhaustive switch cases. Pattern matching is a related feature which is also available in Java now, though as of yet only limited to records.
- the_gipsy 4y agoSo it's a Frankenstein monster, with no real pattern matching support. Good luck with using it in the real world.