Reputation: 119
I'm reading a book about Go. In the interfaces chapter i found this statement:
In the Go runtime, interface are implemented as a pair of pointers, one to the underlying type and one to the underlying value.
Can someone explain me these words with a concrete example?
Upvotes: 1
Views: 1411
Reputation: 2784
This has pictures! Russ is the author of the initial Go gc compiler interface implementation. There have been a few minor revisions.
Go Data Structures: Interfaces
Russ CoxThis post is my take on the implementation of interface values in the “gc” compilers. This post has pictures.
For Go source code see go/src/runtime/iface.go
.
Upvotes: 4