4 ms·
> get monomorphized copies (not erased to "any") of each function for all concrete types used That's not exactly true. You get one concrete function for all ge
by paullgdc 2y ago
> get monomorphized copies (not erased to "any") of each function for all concrete types used
That's not exactly true. You get one concrete function for all generic pointer types for instance.
Generic functions take a hidden paramater called a dictionnary, which is fairly similar to vtable, since it contains type information and pointers for all methods of the generic type that the function calls.
So methods on generic types are still performed through an indirection.
https://github.com/golang/proposal/blob/master/design/generics-implementation-dictionaries-go1.18.md https://github.com/golang/proposal/blob/master/design/generi...
- erik_seaberg 2y agoThanks, had not seen that before. It's odd that they came close to reimplementing method dispatch for builtin types, but didn't surface it for developers.