It doesn't get a pointer to the struct, it gets an object that implements whatever interface. At least that's the story from the type system perspective.
Given that, it seems easy enough to just pass a {pointer, vtable} value.
In C++ (if I understand correctly) each object/class has one vtable. In Go, it seems that each type has as many vtables as are needed for the contexts it's called in.
See also type classes in haskell.
(this is all guessing. Someone please call me out if I'm wrong)
Given that, it seems easy enough to just pass a {pointer, vtable} value.
In C++ (if I understand correctly) each object/class has one vtable. In Go, it seems that each type has as many vtables as are needed for the contexts it's called in.
See also type classes in haskell.
(this is all guessing. Someone please call me out if I'm wrong)