3 ms·
Java didn't handle it much better, they simply chose a different tradeoff. They chose to implement generics via type erasure, which basically means List<String>
by enitihas 9y ago
Java didn't handle it much better, they simply chose a different tradeoff. They chose to implement generics via type erasure, which basically means List<String> and List are the exact same classes at runtime.
.NET chose to implement specialised generics. Many people think that is a better tradeoff.
- KMag 9y agoNote that Java's originally only generic type, the array, has C#-style reified generics. The early JVM implementors should have felt a bit dirty in providing reified generics support for arrays at the VM-level without at least having a forward-compatible VM-level provision for general reified generics.
- Someone 9y agoI think they made the right choice at the time. Targeting devices smaller than desktop computers about 5 years before C# (in a time when Moore’s law was in full swing), they had to cram the jvm in much smaller systems than C# targeted.
- int_19h 9y agoC# did the same exact trade-off in 1.0.
- deleted 9y ago[deleted]
- mwkaufma 9y agoSee also: syntax-baked reified arrays, slices, maps, and channels in go (but "no generics" right?)