Just a note, this is adapted from the author's book Programming in Go.<p><a href="http://www.amazon.com/Programming-Go-Creating-Applications-Developers/dp/0321774639/" rel="nofollow">http://www.amazon.com/Programming-Go-Creating-Applications-D...</a><p>This article is second in a series. Discussion of the previous article on HN: <a href="http://news.ycombinator.com/item?id=4351992" rel="nofollow">http://news.ycombinator.com/item?id=4351992</a>
I know you can use the empty interface but it hands off type checking to the runtime, which neglects the type system for a bit of generality and defeats the safety of having static typing in the first place.
Thanks for this - I've been through the golang wiki tutorial, but this (ab)use of an empty interface for storing "any"-type in a collection was a great idiom to be aware of.