I've read through the Effective Go and Go Tutorials as well as some source, but the exact mechanism behind the interface {}
syntax is Go is somewhat mysterious to me. I first saw it when trying to implement heap.Interface
and it seems to be a container of some kind (reminds me of a monad a little) from which I can extract values of arbitrary type.
Why is Go written to use this? Is it some kind of workaround for generics? Is there a more elegant way to get values from a heap.Interface
than having to dereference them with heap.Pop(&h).(*Foo)
(in the case of a heap pointers to type Foo)?