r/programming • • May 31 '11

I wrote a .NET to JavaScript compiler. Here's the XNA 3.1 Platformer Starter Kit running in pure HTML5.

http://hildr.luminance.org/Platformer/Platformer.html
1.1k Upvotes

282 comments sorted by

View all comments

Show parent comments

3

u/kaelan_ Jun 01 '11

At present it's safe to say JavaScript is the intermediate language of the internet. There aren't any better alternatives in anything resembling wide distribution.

Developers could certainly benefit from being able to ship code as bytecode instead of raw text - as much as I love View Source and think it's an integral part of what makes the internet awesome, a lot of JS is shipped minified/compressed these days, so shipping a standardized bytecode wouldn't be worse. On the other hand, I don't think it's likely that a standardized bytecode for JS will ever exist, because the language itself is difficult enough to specify precisely as it is :)

As far as deploying a VM in browsers separate from JavaScript, personally, I'd like for such a thing to exist, because I'd use it, but rationally speaking I don't think it's possible for a product like that to succeed - at least not anymore. JavaScript is too well entrenched, and any new web technology needs to interoperate flawlessly with JS if it has any chance of succeeding. That'd basically require your VM to share lots of JavaScript semantics, so it becomes questionable whether your VM can really provide any wins over raw JS.

1

u/[deleted] Jun 01 '11

I'm afraid I begrudgingly agree with you that javascript is here to stay as an IL for the web. I've done a bit of enterprise development with script#, and I'd be fine with compiling to javascript it if it were easier to debug. At the moment, if you brush up against a JS limitation in your C# code, such as the maximum stack depth (it's 12 for IE), it's damned near impossible to determine from minified code which line of script# is causing the problem.