3 ms·
Why would that be awful?
by mcronce 5y ago
Why would that be awful?
- morelisp 5y agoFirst, because `[R io.Reader]` is an awful way to spell "force devirtualization". It's not explicit about what it means, and it's not derivable from first principles like Go's other odd spellings, e.g. `interface{}` or `var _ Reader = T{}`, are. Second, it doesn't really promise to devirtualize it. If what I have is a variable of type `io.ReadCloser` - not just implementing it, but already boxed - it's not going to be able to unbox it for me. Third, if that was all or even primarily what we wanted out of generics it would've been much better to spend the past two years hacking on the inliner and other parts of the compiler to improve devirtualization. I don't think it would be awful to fix the unncessary pointer indirection (which looks like it's already happened), but I don't want 10x or even 2x longer compile times just because someone is trying to get the compiler to avoid boxing. It's a tradeoff, vs. e.g. spending that time simplifying methods to get the inliner to approve of them, which is win/win.