Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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 but it's a list of ideas rather than features promised.



C 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: