Table of Contents for Programming Languages: a survey
For information about the CIL's intermediate language, see the CLR language.
---
---
" zastrowm 4 days ago
link |
One of the primary problems with this {emulating the CLR on the JVM} is generics (java/JVM uses type erasure, CLR/C# keeps type information) and value types (CLR/C# has them, JVM does not); That's why you can implement the JVM on the CLR (see IKVM.NET[1]), but not the other way around.
[1]: http://en.wikipedia.org/wiki/IKVM.NET
reply
meddlepal 3 days ago
link |
Fwiw, when Gavin King (Ceylon) did a AMA on Reddit a while back I asked about how they implemented reified generics on the JVM:
https://www.reddit.com/r/programming/comments/2iszra/ceylon_...
reply
https://www.reddit.com/r/programming/comments/2iszra/ceylon_11_is_now_available/cl5vp6x
[–]meddlepal 1 point 1 month ago
I've been following Ceylon and Kotlin somewhat closely for the last year or so and if I recall correctly the Kotlin guys dropped their plans for generic reificiation citing complexity and a need for a modified Java bytecode. How did the Ceylon team manage to implement generic reification on the JVM?
permalink save parent report give gold reply
[–]gavinaking[S] 1 point 1 month ago
Well, each type parameter of a generic concrete class or of a generic method corresponds to an ordinary parameter at the VM level, and that parameter receives a sort of token that allows reification of the type it represents if/when it is needed. In practice, the common case is that it's not necessary to materialize the type. Furthermore, in practice, most methods and most concrete types are not generic, and those that are (ArrayList?, HashMap?) have at most one or two type parameters, and much more internal state. Thus, the performance cost turns out to trivial.
permalink save parent report give gold reply
emjaygee 4 days ago
link |
It would be super difficult to represent value types, generics and the reflection metadata in the JVM without building some kind of giant abstraction layer. MSIL is rich, maybe overly rich. If you get rid of value types and generics from C# you're basically left with ... Java.
reply
nickik 4 days ago
link |
Watch this awesome keynote by Brian Goetz, he talks about valie types and generics.
Brian Goetz - Stewardship: the Sobering Parts
http://m.youtube.com/watch?v=2y5Pv4yN0b0
reply
Gurkenmaster 3 days ago
link |
Not quite. There are still some features that are not possible on the jvm like async/await.
reply
---
Like the JVM, the CLR has a verifier to ensure that even if bytecode is created by a malicious actor, it will not be executed if it could crash the machines (does not typecheck): http://www.ecma-international.org/publications/standards/Ecma-335.htm
---
Some open source implementations:
http://referencesource.microsoft.com/#mscorlib/system/string...
Embedded:
---
---
---