HNHacker News
TopNewBestAskShowJobs

mchristensen

3 karma · joined February 25, 2020

submissionscomments
mchristensen··on Show HN: Using generics to build a Lodash for Golang
The latest generics design proposal is here: https://blog.golang.org/generics-proposal. This could land as early as Go 1.18 beta.

I've started putting together the beginnings of what I hope will become a utility library like Lodash/Underscore (in the JS world) or go-funk[0] (in the Go world).

Generics means no longer choosing between code duplication (multiple type-safe function implementations) and losing compile-time type-safety with reflection-based implementations. This is the current trade-off in e.g. go-funk.

More info in blog post: https://github.com/mschristensen/go-funk-generics

Feedback welcome - especially with regards on how to achieve method chaining...!

[0] https://github.com/thoas/go-funk