4 ms·
Couldn't you use an empty interface to store arbitrary values? From the tutorial: Every type implements the empty interface, which makes it useful for things l
by jkn 15y ago
Couldn't you use an empty interface to store arbitrary values?
From the tutorial: Every type implements the empty interface, which makes it useful for things like containers.
Unions are on the roadmap: http://golang.org/doc/devel/roadmap.html http://golang.org/doc/devel/roadmap.html but it's a list of ideas rather than features promised.
- JulianMorrison 15y agoC people: think of interface {} as roughly the same as void*, except that values pointed to preserve information about their type which can be extracted and used later.