Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, wanting some other language in the browser is a very common wish on hacker news. It's just completely and utterly impractical in real life.

Even if you found some way to get some other language into the browser without translating to javascript; (and this has been done before. remember vbscript?)... the new guest language has to co-exist with any javascript that might also run on the page, share the same memory, share the same dom objects, share the same GC, and avoid all the multiple potential nasty browser crashing bugs that could result from trying to do that. And you have to ship the runtime for that language along with the browser, or as sigh another plugin. And guess what, no backwards compatibility.

Given that, you then have to cope with the fact that javascript's GC might not totally make sense for your language, and do all the workarounds that requires.

Compiling to ASM.js gets around this by essentially giving you a low level VM whose bytecode just happens to look like javascript, and whose behavior when interpreted as javascript happens to be correct. When run in firefox, the code is short circuited and ahead-of-time compiled. It doesn't have to deal with the javascript GC since it allocates a heap for the guest program ahead of time as well.

This is really cool if you think about it. You get javascript's more or less secure sandboxing, you get access to all the apis, you can interact just fine with existing javascript libraries, with about the lowest amount of overhead you can get just short of the NaCl approach (which is basically just a revisit of activeX)

The only downside to all this:

it's not the web.

This is not web. It runs in a web browser, but it's downloading a blob up front, ahead of time compiling, and playing a raw executable inside a browser host.

There's considerable advantages to zero-install programs and games. But you know, exchanging one kind of opaque inaccessible blob in a webpage for a different kind that just happens to not need plugins is not that great.

Accessibility is a good thing, and we shouldn't be too eager to throw it away for the shiny.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: