4 ms·
How is the generics story going in golang? I wonder if it brought a major paradigm shift in the way Go is written.
by FlyingSnake 4y ago
How is the generics story going in golang? I wonder if it brought a major paradigm shift in the way Go is written.
- dgunay 4y agoIt is definitely better than before, but doesn't really change the game much. It has severe limitations. My biggest hope when generics were announced was that we'd finally get an alternative to writing `if err != nil` 10+ times per function, but it doesn't support generic method type parameters. That alone kneecaps it severely by making type-safe method chaining useless in most scenarios (unless you never need to map to another type, ever, I guess. Lucky you.)
- zinclozenge 4y agoIt's pretty rare you need to write anything generic unless you're writing a library, or library like functionality.
- bbkane 4y agoI don't know about a paradigm shift, but the craziest use of them I've seen is https://github.com/jhbrown-veradept/gophercon22-parser-combinators https://github.com/jhbrown-veradept/gophercon22-parser-combi... . I watched the talk, thought I understood it "enough", then completely fell on my face trying to write a JSON parser. Could be me though, maybe I should try it again now that it's been a few months