3 ms·
So you would prefer to write match result => error instead of if err != nil? Excuse me for not being convinced that this isn't just fussing over syntax.
by elvlysh 2y ago
So you would prefer to write match result => error instead of if err != nil? Excuse me for not being convinced that this isn't just fussing over syntax.
- valenterry 2y agoIf a language supports Result types, that usually means it also comes with some kind of syntax to use it. Check out some Rust code (or Haskell, Scala, F#, ...) and you will find that in those languages you barely match on the result because you don't have to. Whereas you have to do "if err != nil" in golang all the time.
- deleted 2y ago[deleted]
- stouset 2y agoIt isn’t just fussing over syntax, but that would require you actually being curious enough to learn why instead of needing to dismiss people’s valid critiques of out hand.
- tubthumper8 2y agoIt's not just syntax, a sum type forces checking for the error whereas a product type does not, so it's a semantic distinction too