The difference with JSIL is that it compiles .NET Intermediate Language (IL), and therefore works with any .NET language – though note that:
JSIL is still in development. You will hit bugs
The screenshot says it all
Technically that’s neat, but what’s the point? I can understand compiling C# to JS for its high-level constructs, type safety, and IDE support. But compiling IL to JS?
If you were to translate existing assemblies that rely on the regular .NET Framework you’d have to pull in absurd amounts of libraries before the result works without a .NET installation. You’d also have to sort out any platform-specific code in the BCL. On the other hand, if you’re happy translating only specially written IL then you could just use Script# and directly translate from C#, skipping the intermediate .NET compilation step.
Good questions, Chris:
There are a surprising number of real apps that only rely on small portions of the BCL. So as a result I only have to implement those portions to get the app working. The pay-off there works out pretty well.
In the long run my strategy is to compile the Mono version of mscorlib (and related libraries) to JS so that you will only need a custom implementation of things that can’t be translated – unsafe functions, internal runtime calls, etc – which will make it possible to run more sophisticated apps.
And finally, while I can’t comment in detail on how to compare Script# and JSIL – I haven’t used Script# in depth – the fact that Script# has to implement C# compilation seems to be a downside. Last time I checked, it still did not have complete support for features like generics, ref parameters, overloading, nested types, using, and goto. I’m not sure I would want to write C# if I had to give up all those features.
The true prophet you refer to is Microsoft’s Erik Meijer.
Comments are closed.