andrewducker: (Default)
andrewducker ([personal profile] andrewducker) wrote2010-11-11 12:55 pm

Coding in web browsers

[livejournal.com profile] robhu has a good point over here.

At the moment we write Javascript in web pages, which is then compiled down by the various JIT methods that Firefox/IE/Webkit use to make it super fast.

Seeing as what's run clearly isn't the actual JS itself, but bytecode, why not have a standardised bytecode that all browsers would support, which would then mean you could write your code in any language you liked, providing there was a compiler to convert it to the standardised bytecode?

At the moment Google uses GWT to convert Java into Javascript that then gets converted into the running code, (And MS used to have something similar) wouldn't it be handy if the intermediate step wasn't necessary?

[identity profile] strawberryfrog.livejournal.com 2010-11-11 02:45 pm (UTC)(link)
The bytecode that each browser turns the Javascript into is obviously different for each browser

Currently yes. But there's no reason why that should be so. In fact, isn't that the proposal?

Something like how The Java and .Net bytecodes are standardised and designed to be platform-independent, which is kinda the point. They can be executed by different engines. Those engines may have different internals, but executing that standard bytecode is their entire purpose.

.Net bytecode is less obviously "platform-independent" than Java. But there are 32 and 64 bit windows runtimes that work with the same bytecode. And mono/Linux run that same bytecode.
Edited 2010-11-11 14:50 (UTC)