3 ms·
Erasing and replacing = Erasing the parameters and replacing them with ad-hoc polymorphic functions generated by the compiler. Like what C++ does with templates
by Konohamaru 6y ago
Erasing and replacing = Erasing the parameters and replacing them with ad-hoc polymorphic functions generated by the compiler. Like what C++ does with templates.
Basically do all languages with parametric polymorphism do that?
- SamReidHughes 6y agoAny language’s implementation can do that in places as an optimization. But Haskell is one example where it doesn’t generally do that, and the code above works. I never checked this question out for other languages, but Java, likewise, only supports generics on reference types and generates one bytecode per definition, so it should be similar to Haskell in that respect.