4 ms·
Something like this? http://play.golang.org/p/6nvdLWOi5D http://play.golang.org/p/6nvdLWOi5D
by khyryk 13y ago
Something like this?
http://play.golang.org/p/6nvdLWOi5D http://play.golang.org/p/6nvdLWOi5D
- tikhonj 13y agoNot quite. What you have is a single type interface{} that happens to be the super type of all other types. You still haven't solved the issue of having multiple different types in a tuple--you've just thrown all the type information away! Think of a tuple as an anonymous struct. (Or perhaps think of a struct as a tuple with labels :P.) We want to statically differentiate between a pair of ints, a pair of strings and an int, string pair, which we simply can't do with interface{}.