Planet of the Crabs
🦀 fearless rust


Writing type parametric functions in Go

Posted on by Andrew Gallant: BurntSushi

Go’s only method of compile time safe polymorphism is structural subtyping, and this article will do nothing to change that. Instead, I’m going to present a package ty with facilities to write type parametric functions in Go that maintain run time type safety, while also being convenient for the caller to use.