3 ms·
All 3 use the `Class<T>` syntax and have the ability to create functions that operate on any type. If they weren't influenced by each other (e.g. C++ allows you
by rhdunn 4y ago
All 3 use the `Class<T>` syntax and have the ability to create functions that operate on any type. If they weren't influenced by each other (e.g. C++ allows you to specify a template/generic type for a function) they would have different syntax.
Java generics ended up the way they did because Java had/has a strong backward compatibility guarantee and wanted to fit into existing List/etc. interfaces and classes that work on objects. This resulted in the decision to erase the type from the runtime bytecode signature.
C# supports reified generics as a result of looking at how Java implemented generics and the problems that introduced. Microsoft were also in a position where .NET/CLR were at version 1, so made the decision to break the bytecode for version 2 in order to support reified generics.
Scala, Kotlin, and other languages have worked to follow the C# model as much as they can within the limitations of the Java bytecode/runtime.