← Back to context

Comment by pregnenolone

6 hours ago

> Compare this to the constraints and workarounds that Kotlin and Scala have due to type-erasure on the JVM.

The creator of Scala disagrees: https://youtu.be/Xn_YpUtXWT4?t=850

Not necessarily. You can ignore the reified generic system in the CLR and monomorphize it in the CIL output for your language. Debugging for users is usually a nightmare though due to the monomorphization. The benefit of a type-erased runtime is the interop between the languages built on the runtime.

The monomorphization of CLR generics is what NativeAOT does, though it doesn't support some C# features.

TypeScript is essentially C#, but with type-erasure and lacking the low-level struct & pass-by-reference features.

I do think the C#/CLR struct implementation is better though.