3 ms·
I’ve always felt like the lack of many complex language features nudges teams to also keep their code simple. There is always two aspects to a language works i
by lokar 2mo ago
I’ve always felt like the lack of many complex language features nudges teams to also keep their code simple.
There is always two aspects to a language works in practice: how it formally works, and how the community uses it.
Go is (was?) simple, and also (encouraged by the language and influence from its developers) the community mostly aims to keep the usage simple.
- josephg 2mo agoIt’s the lack of parametric enums (sum types) which really gets me. I use sum types constantly. Nearly as often as I use structs. For example, in typescript you can define a json value as something like: type JSON = null | bool | string | number | [JSON] | {[k:string]: JSON} Go forces me to reach for interface {}, and use a nest of dynamic dispatch code. It’s horrible. Go code is harder to write, harder to read and it runs slower as a result. The decision is baffling. Especially given go now has generics, which are waaay more complex than enums. And sum types in go could be used to fix the constant (result | error) boilerplate. And remove nullability. Sigh.