(no title)
kosherhurricane | 2 years ago
Laughs in Go.
> While Zig's errorhandling is not bad and miles above Go's
Laughs again in Go. Go has no "foundations" regarding errors, it's just a convention. It has no union types. It doesn't have weird corner cases. It's just a returned value you can handle. Or not.
Of all the error handling paradigms I've seen, Go's requires the least amount of "specialized thinking" (try/catch or whatnot)--it's just becomes another variable.
grumpyprole|2 years ago
dthul|2 years ago
lpapez|2 years ago
So far I have never worked a Go project without a strict linter enabled on the pipeline checking that you handled the case when err != nil. I don't care if it is the compiler or the linter doing it, the end result in practice is that there actually is no chance of forgetting to check the error, and works just as well as a stronger type system while also making the code stupidly obvious to read.
memefrog|2 years ago
Sum types might be the 'mathematical dual of product types' but programming languages are not mathematics. The possibly implementations of sum types are quite varied. It makes sense in low-level languages for the programmer to use what makes sense in the particular situation.
Tozen|2 years ago
[1]: https://github.com/vlang/v/blob/master/doc/docs.md#sum-types
kosherhurricane|2 years ago
I dunno, my IntelliJ calls out unhandled errors. I imagine go-vet does as well.
cdaringe|2 years ago