3 ms·
> The basic tradeoff is monomorphization (code duplication) vs. boxing (in Go speak, interface{}). And even that is not the whole story, just because you reify
by masklinn 9y ago
> The basic tradeoff is monomorphization (code duplication) vs. boxing (in Go speak, interface{}).
And even that is not the whole story, just because you reify generics does not mean you have to monomorphise everything, Microsoft's C# compiler only monomorphises value types.
Also Go may box in other contexts than interfaces depending on escape analysis (according to https://golang.org/doc/faq#stack_or_heap https://golang.org/doc/faq#stack_or_heap).
- slrz 9y agoThe FAQ entry does not state that the Go compiler boxes escaping variables (it doesn't, AFAICT). How did you arrive at that conclusion?