3 ms·
The go2 proposal (as currently implemented) is a source-to-source translator back to go1, so neither in that case. As for the existing implementation of generi
by mappu 6y ago
The go2 proposal (as currently implemented) is a source-to-source translator back to go1, so neither in that case.
As for the existing implementation of generic map[K]V, generic []T, chan(T), etc., it's a best-of-both-worlds mix - a kind of erasure (there is only one map implementation in a Go binary) but with a static vtable for accessors without Java's need for boxing - all possible owing to the clever coupling between the runtime and the compiler.
See https://dave.cheney.net/2018/05/29/how-the-go-runtime-implements-maps-efficiently-without-generics https://dave.cheney.net/2018/05/29/how-the-go-runtime-implem...