4 ms·
We need a standard wire format for code to be run on browsers. Fortunately we have one: it's called JavaScript. If you look at the internals of that format, it
by rwallace 14y ago
We need a standard wire format for code to be run on browsers. Fortunately we have one: it's called JavaScript. If you look at the internals of that format, it happens to be designed to be written directly by humans, but if you find that design suboptimal (and it would be surprising if it wasn't, considering it was put together on a ten day deadline with contradictory requirements) you can ignore it and just treat it as object code to which your favorite language can be compiled.
Doesn't Google make some internal use of a tool chain that compiles Java to JavaScript? And then of course there's Dart and CoffeeScript. I'm sure there'll be more.
- tibbe 14y agoUsing JavaScript as object code is particularly efficient though.
- carsongross 14y agoYou can compile anything into anything, but for the vast majority of languages, the easiest thing to target with sane semantics is a virtual machine, not a crazy half-baked language (that I end up coding in for about 40% of my day.) A bytecode standard would free us from the crazy design decisions of javascript, give us source-level debugging, etc. And it wouldn't be that hard, given all the fine examples of VMs sitting around. My sense is that the people that suggest javascript as a compilation target really don't want competition for javascript in the browser.
- rwallace 14y ago> A bytecode standard would free us from the crazy design decisions of javascript Not really, because most of the complication and mess is in the document object model, not the language syntax. How do you propose to solve that problem? > My sense is that the people that suggest javascript as a compilation target really don't want competition for javascript in the browser. You sense incorrectly. I'm not working in that area, I don't have a dog in that fight. I just think it's a good idea to point out problems with a proposed solution before somebody goes off and puts a lot of work into trying to implement it.