I don't really know where to place this comment. Multi-language systems existed before, therefore Wasm should not, because it's already been done?
It's interesting that none of the languages that you list made .NET a primary target and have all either bit-rotted unofficial ports or sunsetted their mainline support. It's hard to say whether languages that now target Wasm will suffer the same fate, since that depends on level of maintenance that each project allocates to particular targets. Still, I don't really get your point.
If only the CLR had followed CLR footsteps as well, but they didn't even try after the DLR. Most non-Roslyn languages can barely interact with modern C# or the newer build configurations; even F# is playing catch-up and they're part of the official toolchain.
That is the sin of guest languages, that is why C rules on UNIX, JavaScript on Web, Java on the JVM, C# on the CLR, ....
Every guest language means additional IDE plugins with platform knowledge, since most communities want idiomatic libraries, an ecosystem on top of the ecosystem, as the actual platform is only implemented in a main "systems" language, mastering it is required anyway for all the leaky abstractions on the platform, additional build toolchains,...
In the end, each polyglot platform achieves a global maximum of main language, and possibly a winner among all guest languages, even if it takes a couple of years with projects fading away until this happens.
It sucks, however so it is the outcome of human nature attention span, and not being able to keep momentum for all languages across the whole lifetime of a given platform.
It seems like the JVM has been more successful than most platforms at supporting other guest languages. Java is still dominant, but Kotlin's pretty popular (as other comments have mentioned) and Scala has a nontrivial amount of usage. I think JRuby's also used some, but I'm not sure.
Arguably a perspective here is not that the JVM is more successful but that simply that Java as a language is less successful/more deficient language than C# and leaves more evolutionary niches available for other languages to coexist in its ecosystem, whereas C# checks more boxes generally. One reading of the history of Kotlin is that is almost directly the reason for Kotlin's existence in the first place because Java itself fell so far behind C# state of the art.
The DLR made it much easier for dynamic languages on .NET to interact and share infrastructure on top of the CLR, but it also gave C# directly just enough dynamic language powers that filled most people's use cases for that niche.
Even in the current race between C# and F#, unless you are using features such as Units of Measure or Type Providers, there is often a sense of "you don't need to use F# because that feature will be eventually in C# anyway" and "F# is just a proving ground for C# ideas". The F# community continues to try to find marketing messages that aren't that and better highlight some of the niches that F# can fill that C# won't. The most recent attempts have been trying to position F# as a "data sciences" language useful for Notebook-driven development in direct comparison/competition to Python/R/Julia. C# actually is finally useful in Notebooks now and has some alright REPL support, but F# likely will always better fit that niche. It will be interesting to see if that marketing approach helps.
> It seems like the JVM has been more successful than most platforms at supporting other guest languages
I think that’s more because of the amount of good Java binaries than because the JVM is good at supporting alternative languages.
Scala had to make a few design choices they would never have made if they didn’t want to target the JVM and be compatible with existing Java binaries.
Examples:
- having Option[T], but still having null, too.
- value types aren’t supported in the JVM (yet), so they’ve had to implement them using classes.
- scala’s reflection would have been easier to understand if they could have tweaked the JVM to implement it (scala had to work hard to map its type system to that of the JVM)
- scala has its own integer classes that are subtly different from both Java’s value types and it’s integer classes.
Kotlin mostly is Java with a different syntax. Like scala, it must be doing some magic to support its value classes.
Also, as another post in this thread said, some languages my need a garbage collector that behaves different from the JVM one. If so, you either adapt, or give up running on the JVM.
Scala 3 has an option to exempt null from ordinary types, marking nullable types as T | None, so this is not related to the JVM, this can be completely decidable at compile type.
The reflection claim is also questionable, as Scala used to be available for the CLR as well, but that version was abandoned, while the JVM is striving. In fact, erasure of generics help with guest languages, as it doesn’t bake into the variance.
> Scala 3 has an option to exempt null from ordinary types, marking nullable types as T | None, so this is not related to the JVM
I don’t know scala 3 well, but if it can make nonnullable types (that’s what “exempt null from ordinary types” means, isn’t it?), that’s not something the JVM knows about (although that may be changing with the addition of value types to the JVM)
Even if that’s incorrect, there are plenty of other examples of types that map badly to the JVM, such as Either[String,String] and AnyVal (a scala class with subclasses such as Int)
“Universal traits allow basic inheritance of methods for value classes, but they incur the overhead of allocation”
And yes, scala3 has opaque types, but in the JVM, those must revert to their underlying type (if they don’t, the performance gains are lost), and scala3 also still has value classes.
> this can be completely decidable at compile time.
It can’t the moment you load a jar and call a method in it, and I think about every scala program does that.
> The reflection claim is also questionable
The JVM has strict single inheritance. Scala supports a form of multiple inheritance through traits. There’s no trivial way to map that to the JVM.
> In fact, erasure of generics help with guest languages, as it doesn’t bake into the variance.
I don’t understand that. It surely doesn’t always help. Scala reflection doesn’t want erasure, so they’ve had to work around that.
> I don’t know scala 3 well, but if it can make nonnullable types (that’s what “exempt null from ordinary types” means, isn’t it?), that’s not something the JVM knows about (although that may be changing with the addition of value types to the JVM)
Haskell or Rust compiles to machine code, which can have invalid/null pointers as well they don’t know about. Nullness is a so-called trivial property, the compiler can prove the absence of NPEs in code output by it, so you only have to check at the boundaries (e.g. every java method will return a nullable type)
I don’t know why would these map badly to java types. Scala unifies primitives with their boxed versions and tries to smartly optimize between them, so it doesn’t have the kind of distinction as Java. Value classes require runtime support so the only thing Scala can do is to alias a primitive as another class, but optimize it away. Of course this is a leaky abstraction, but this is a fact of life on managed runtimes.
Re multiple inheritance: doesn’t map natively, but this also doesn’t need native support. At worst, scala can always just go the Groovy way and intercept any call to/from every such object of theirs and then they can literally do any form of call indirection.
Re reflection: as far as I know Scala doesn’t really require frequent use of reflection, as it can circumvent it at most times through metaprogramming/more expressive language features. Also, type erasure is the norm — most runtimes don’t store type infos.
I think Kotlin is slowly eclipsing Java on the JVM. Its not majority yet but most new projects or major refactors I've seen are either 100% Kotlin or majority Kotlin.
I would not be surprised if Kotlin takes a majority share eventually
Kotlin is Java with minor syntax changes - it brings nothing new to the table and you write it the exact same way as you would Java. It's an easy sell for shops that want the feeling they're making forward progress in the field of computing but who don't actually want to change anything.
That’s factually wrong. Null-safety alone changes completely how you write Kotlin, add to that coroutines, extension functions and dozen other quality of life improvements and you get completely different style.
It feels to me a little bit like how geographic regions wind up working out dominant spoken/written languages.
The guest languages are like relying on (human or machine) speech/writing translation services to communicate with folks who only know the local lingua franca.
That added friction hobbles the minority languages.
Perhaps AI will aid in greatly reducing these issues over time (and I say this because large language translation models and text to speech + speech to text are finally reaching professional human quality while running on local hardware today). But I can't think of any other good method to hold back the floodgates of people being forced to choose between their mother tongue (with its corpus of invaluable baked in stories and perspectives) and being understood by others.
I was just looking at the status of IronPython, and it's on Python 3.4, which has been end-of-life for nearly five years. I'm not sure that indicates practical usability for most developers. Only C#, VB, and maybe F# actually seem like a safe choice on .NET. (PowerShell too, but that's a different use case.) So, just because something has been, or can be, done "in theory" doesn't mean all that much.
Unless you were intending this as a criticism of .NET?
IronPython is indeed quite a pain to work with, and for a lot of reasons beyond the age. For instance, you don't get numpy or any dependencies that themselves depend on quirks of CPython. The alternative is PythonNET, which executes python in CPython context, but provides nearly the same interoperability* with CLR assemblies. There's many devils in the details of that asterisk, and I'm frankly not knowledgeable enough to explain them; but in my experience, things work well enough that I'm satisfied with the integration provided.
EDIT: Yes, F# is an ML-style language. I was answering the spirit of the question, which was 'statically-typed functional-first programming language running on the .NET CLR'.
> More than 20 programming tools vendors offer some 26 programming languages — including C++, Perl, Python, Java, COBOL, RPG and Haskell — on .NET.
From https://news.microsoft.com/2001/10/22/massive-industry-and-d...