4 ms·
I'm implementing a somewhat complex software in both Go and Rust. The Rust version is bith shorter and more readable - and probably more efficient - thanks to
by daghamm 2y ago
I'm implementing a somewhat complex software in both Go and Rust.
The Rust version is bith shorter and more readable - and probably more efficient - thanks to Rust enums and Rust error handling. I don't understand why golang doesn't copy Rust here. The error handling in particular could be a very simple change.
I am not a huge fan of go:generate and similar projects. They add a level of unknown that goes against the core Golang design values.
- JetSetIlly 2y ago> I am not a huge fan of go:generate and similar projects. They add a level of unknown that goes against the core Golang design values. I'm not sure I would agree with that. go:generate is a core part of Go since v1.4 and the enum generators are the kind of thing that was intended. https://go.dev/blog/generate https://go.dev/blog/generate That said, enums would be a welcome improvement to the language. But even then, I think go:generate has a place.
- frou_dh 2y ago"add(ing) a level of unknown" is a very fair description from a code comprehensibility standpoint, since the go:generate directive is about running arbitrary executables.
- JetSetIlly 2y agoTrue.
- foldr 2y agoThe is ameliorated somewhat by the fact that go generate is not part of the build process. Its output would typically be checked into the repo. So as long as the generated code is reasonably readable, it should not have too much of an impact on code comprehensibility.
- foldr 2y agogo:generate is mostly just a marketing failure. If they'd called it 'procedural macros', everyone here would think it was the bee's knees.
- daghamm 2y agoTo be honest, I'm not a huge fan of Rust's #derive() magic either.