Re:Interface Upgrades in Go
by zaphar on Sunday December 07, 2014 @10:19PM
(#8714741)
For even more similar look to pattern matching look at Go's type switch.
It's really good when you have a set of mutually exclusive interfaces or types.
[ Parent
| on HN ]
You can do a passable impression of sum types that way too: http://www.jerf.org/iri/post/2917
Re:Interface Upgrades in Go
by arnehormann on Monday December 08, 2014 @02:03AM
(#8715326)
You should use
switch v := i.(type)
so you can access v as the type in a case.