4 ms·
Some things are just really painful to do in Go: merging maps, drilling into a JSON structure, checking if an element exist in a slice. Hopefully generics alle
by digianarchist 5y ago
Some things are just really painful to do in Go: merging maps, drilling into a JSON structure, checking if an element exist in a slice.
Hopefully generics alleviates some of this boilerplate.
- skybrian 5y agoI haven't used Go in a while, but those don't sound particularly hard. Isn't searching for an element just a for loop?
- erik_seaberg 5y agoRereading the same loop more than once is not a good use of time. A generic function can be named and reused forever.
- skybrian 5y agoWhen I was writing Go I used to write little helper functions named "findThingy" that just wrapped a single for loop. A typical module might have a few of them. It wasn't hard to read and it wasn't that big a deal. I think the boilerplate from error handling hurts readability more. It will be nice not to have to do that, though, if I get back to Go again.