Skip to content

Comment on Toward Go 1.3parent

Comments

I do definitely want some kind of support for genetics in golang. I do understand and respect the difficulties the principal authors have with integrating it into the language as-is.

There's actually a sort of workaround that I kind of liked:

http://play.golang.org/p/LkVWkyph75

Discussion here:

https://groups.google.com/forum/#!topic/golang-nuts/UyKree3B...

The basic approach is to define most of your generic data structure to use interface {}, and then have type-specific get/put and maybe comparison. This then minimizes the boilerplate code needed while retaining type safety. Implementing the generic functions requires a little more care than usual. But I think it is one of the best approaches for the language currently.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.