3 ms·
I think the article answers that. There's a whole bunch of design and implementation decisions that would be very different and more complex with generics.
by emmelaich 8y ago
I think the article answers that. There's a whole bunch of design and implementation decisions that would be very different and more complex with generics.
- almostdeadguy 8y agoThis is really not different from how generics are implemented in many languages, it's almost identical to how haskell implements parametric functions w/ class constraints (i.e. a dictionary w/ concrete functions for implementing the algorithm for a specific set of type parameters is passed): https://www.schoolofhaskell.com/user/jfischoff/instances-and-dictionaries https://www.schoolofhaskell.com/user/jfischoff/instances-and... The only difference is that haskell generic functions can be specialized and the methods in the dictionary can be inlined: https://wiki.haskell.org/Inlining_and_Specialisation#What_is_specialisation.3F https://wiki.haskell.org/Inlining_and_Specialisation#What_is...