Hacker News new | ask | show | jobs
by StevePerkins 4243 days ago
I'm often dismissive of Mozilla, for being so all-over-the-map and unfocused sometimes. However, I'm grateful for them being the only browser player that really does seem interested in progressing JavaScript.

All of the other players seem more focused on transpiling solutions, which are really about replacing JavaScript with something else under their control. Mozilla is pretty much the only player that genuinely works to improve JavaScript without another agenda.

3 comments

asmjs is a transpiling solution. No one is going to rewrite UnityEngine in hand-written asmjs. The vast majority of asmjs code is going to be transpiled, you can literally see it in the name: asm
I think by a "transpiling solution," he means something that is transpiled from (like coffeescript or dart), as opposed to something that is transpiled to, which is asm.js.

The problem with transpiled languages is that each transpiled solution is just one language. Many of them are nice, and almost all of them are improvements on JavaScript, but they're still just languages. Asm.js basically lets you use anything you want, which is an entirely different category of solution. In particular, it lets you use languages that already exist, for which you have experience and tools and libraries and standards and whatnot.

Yes, it is a transpiling solution, but it's one that's a subset of JavaScript. This means it's compatible with all JS engines and lives in the same ecosystem.

It's quite different from, say, NaCl or Dart, which introduce a completely new language with a new set of APIs.

Dart the platform is compatible with all JS engines, Dart2JS.

I could rightly claim that DartVM is just a specialized two-stage compiler that kicks in to give a speed boost.

Compatible != portable. In the real world, performance matters. If I deploy my new triple-A game to the Web, and I'm only going to get 60fps on 25% of the browsers, and 15fps on the rest of them, do I really consider it the same ecosystem?

> If I deploy my new triple-A game to the Web, and I'm only going to get 60fps on 25% of the browsers, and 15fps on the rest of them, do I really consider it the same ecosystem?

This was always an issue on the web. Browsers have always had speed differences on that scale - either due to browser optimizations, or running on much weaker hardware (a phone vs. a powerful desktop). We've never had consistency the way consoles do, which is why AAA games run best there.

> Dart the platform is compatible with all JS engines, Dart2JS.

Not quite. Most of Dart (though not all) can compile to JS, and you can then use the JS version or the Dart version depending on browser support. That doesn't mean existing JS engines can run Dart code, it's just you can choose to fall back to Dart compiled to JS.

NaCl was basically trying to open web to any language.
So is asm.js.
I don't think it's fair to characterize Traceur or TypeScript as plays to put Javascript under their author's control. Both have been useful for developing ES6, which Firefox has also been a leading implementer of. From my perspective almost all of the browser makers doing lots of cool stuff to push forward javascript and the web.
You're assuming StevePerkins was referring to Tracuer or TypeScript, I don't think they were. I assume they meant things like NaCl and Dart.
A bit of an assumption yes, here's my reasoning though. Traceur and Typescript (and perhaps Flow and AtScript) are similar efforts made by different players that require transpilation and are potential visions for a direction javascript could go in. This combined with the author's quote "All of the other players..." made me think that's the family of solutions they were referring to.

NaCl and Dart are both by a single player and there's nothing else like them that I know about but Mozilla's asm.js, which the author is praising here, so they didn't seem like likely candidates.

Dart compiled to JS just like Emscripten.
Technically it compiles to JS, yes, but the reason people have a problem with Dart is the idea of embedding a Dart VM in the browser.

(And some features of the core language only work with an embedded Dart VM)

To me it's just the opposite. Other browser players seem willing to support a diverse ecosystem of browser languages. Mozilla is the one that wants to limit everyone to Javascript (and while you can argue how much they "control" it, it's a language that was invented for the project that's now Mozilla and has many of the same people involved).
> "Mozilla is the one that wants to limit everyone to Javascript..."

True, and they dare to call this "Open Web".