andrewducker (
andrewducker) wrote2010-11-11 12:55 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Coding in web browsers
![[livejournal.com profile]](https://www.dreamwidth.org/img/external/lj-userinfo.gif)
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?
no subject
Heck, I'd be happy with either Java bytecode or IL if they were suitable.
Compiling Java into JS seems terribly suboptimal to me, although I'm prepared to be told that actually it's a good fit. Having something that can be implemented in a standard way by the big 3 would be good.
no subject
But my point is that it's not possible to have the same bytecode run natively in multiple browsers, or indeed in the same browser on different OS platforms. It will have to be run through a VM that translates the bytecode into actual native code in any case, so why not just call the Javascript interpreter the VM?
no subject
It will have to be run through a VM that translates the bytecode into actual native code in any case, so why not just call the Javascript interpreter the VM?
I'm fine with that if JS is expressive enough and powerful enough for that. And the speed losses are within an order of magnitude. I really should play with something like GWT and see how long it takes to spit out the JS for a page.
Because if it's fast and powerful then, yes, absolutely.
no subject
no subject
Starting over might just be easier than trying to improve JS.
(Or it might lead to ten years in committees arguing over it.)
no subject
Of course, it'd need to get picked up as a standard first...
no subject
no subject
no subject
no subject
Similarly, it's possible to write C code that's low-level enough that it's virtually impossible to do better by writing in assembly.
no subject
no subject
no subject
no subject
Another thing to consider is that assembler really requires LOTS of knowledge to actually be better than writing same in C.
Assembly acts as a leverage of your knowledge base, by giving you direct control over constraints that you do not have access to in C.
The amount of knowledge required for assembly to win over C is couple thousand pages worth of knowledge that isn't much use outside assembler programming how many programmers have read it?
no subject