5 ms·
I love iota! It comes in handy everywhere. Don't serialize to raw integers unless you absolutely have to. Serialize to a string value: it's future/oopsie proof
by Steltek 3y ago
I love iota! It comes in handy everywhere.
Don't serialize to raw integers unless you absolutely have to. Serialize to a string value: it's future/oopsie proof and helps with debugging. The nature of iota is pushing people away from bad habits.
But yes, getting warnings about missing enums in switch statements is very handy. But Golang's type system never aspired to be as rigid and encompassing as C++, Haskell, Rust, etc.
- coldtea 3y ago>But Golang's type system never aspired to be as rigid and encompassing as C++, Haskell, Rust, etc. Well, didn't have to aspire to all that to at least make an effort to be more helpful, especially in trivial aspects, like having an actual enumerated type, or an Optional/Error type...
- preommr 3y agoI don't think you understand how minimalist Golang is... the std lib only has room for anything you would ever need for a web service including a full web server, builtins like hashmaps, a bunch of things for concurrent programming like channels, go routines, etc. There's also language features like returning tuples and destructuring them which is actually more advanced than it's peers. To include an optional type would be against go's identity.
- deleted 3y ago[deleted]
- richbell 3y ago> I don't think you understand how minimalist Golang is... the std lib only has room for anything you would ever need for a web service including a full web server, builtins like hashmaps, a bunch of things for concurrent programming like channels, go routines, etc. I can't tell if this is sarcasm. If it isn't, I don't see how what you've mentioned is minimalistic or how adding an option type would be against Go's identity.
- deleted 3y ago[deleted]
- DinaCoder99 3y agoWhy use ints in the first place if what you really want is strings?
- Steltek 3y agoIntegers are far faster, smaller, and golang is strongly typed. Once you're past the serialization phase, strings have many disadvantages.
- IshKebab 3y ago> rigid and encompassing Rigid makes it sound bad. I would suggest "reliable" instead.