4 ms·
I'm afraid that's not the case. Generics are very easy to implement under the following reasonable conditions: 1. you don't care about performance (you simply
by Footpost 7y ago
I'm afraid that's not the case. Generics are very easy to implement
under the following reasonable conditions:
1. you don't care about performance (you simply 'box' everything),
2. you don't care about executable size (you simply specialise every
generic definition to their concrete use cases -- this is what C++
compilers do),
3. you don't do reflection on types in generic definitions.
As "cinnamonheart" mentions in a sibling post, ML's generics are
straightforward, and remain, despite hailing from the 1970, even today a shining example of
programming language design. Unfortunately, Scala had to
violate all three points above to maintain compatibility with Java, and the JVM.