3 ms·
Things that have CLR-like generics work on the CLR. Anything else doesn't. E.g. Scala.
by paulddraper 10y ago
Things that have CLR-like generics work on the CLR. Anything else doesn't. E.g. Scala.
- noblethrasher 10y agoF* has an advanced type system with support for dependent types and refinement types. Yet, it runs on the CLR. Source: https://www.fstar-lang.org https://www.fstar-lang.org
- emodendroket 10y agoI don't really get the complaint. Even if they had type erasure you couldn't use Scala in the CLR because nobody has written a CLR target. And on the other hand, I don't know why there couldn't be a Scala implementation with true generics. A lot of crap like DummyImplicit and ClassTag is there for no other reason than to work around those limitations anyway.
- broiledegg 10y agoI think it's largely an urban myth. All expressive languages whose type systems don't have a 1-to-1 equivalence in the runtime's type system need to employ some degree of erasure. The distinction between "erasure" and "no erasure" doesn't make much sense. It's always just about more (CLR 1, JVM < 10) or less (CLR >= 2, JVM >= 10) erasure.
- emodendroket 10y agoI don't see how you figure. In C# List<string> and List<int> are two different types at runtime.
- broiledegg 10y agoAnd ...?
- emodendroket 10y agoIf you're implementing a CLR language and want flawless interop with everything then you just have the constraint that you need to support generics in the same way that other CLR languages do. I'm not seeing why this model is so much worse.
- paulddraper 10y agoScala had a CLR target for a number of years, but getting the type system to work was so problematic it was eventually abandoned.
- broiledegg 10y agoThat's what I meant with: "That's largely an urban myth."
- emodendroket 10y agoI'm curious in what sense it was difficult to get it to work.
- paulddraper 10y agoPerhaps not the best explanation but this the gist, as given by Scala's creator in an interview https://youtu.be/p_GdT_tTV4M https://youtu.be/p_GdT_tTV4M > It's harder then it looks, because .NET has a very rich type system which happens to be not the Scala type system. In fact, it's very hard to map some of the parts of the Scala types like higher-kinded types...so it's a difficult task, much more difficult than JS or LLVM. LLVM is likely going to be the third target [after JVM and JS] because there we don't need to fight a type system which is foreign to us, which is what the .NET one is.