Live data from Hacker News

ECMAScript 2016+ in Firefox

blog.mozilla.org

41–50 of 93 posts

Re: ECMAScript 2016+ in Firefox

#41

I wonder does ECMAScript 2017 has optional name ES8?

Not really, but there's certainly an off-by-one joke in there somewhere.

Since ES2015 the official nomenclature is ES, to convey that a new version of the standard is cut yearly. While this may result in somewhat underwhelming releases, like ES2016, at least it's much easier to reason about and target than previously. Case in point, it took ten years or so to get from ES3 to ES5, and another five-six years I believe to get to ES2015.

These were substantial releases to be sure, but for a long time the uncertainty about when a spec draft was considered done was anything but fun, and I for one applaud the new nomenclature and process for being much, much easier to reason about and target.

Re: ECMAScript 2016+ in Firefox

#42
post #35

Realistically, when are we going to see the modules situation resolved? ES2017? ES2018? I know, I know, just use a transpiler and emit a bundle... but really? It's been a draft since 2015, and no browsers have any support for it yet, despite full support for the rest of the standard? Are modules really that controversial? I'm kind of disappointed, honestly, that despite all the progress in the ecosystem, this long st…

The purpose of Babel/transpilers is to eventually allow users to use the native versions of language features. Native support will eventually be faster (not at first), will result in less code sent to users (compiled code is larger), and easier to debug (don't need sourcemaps). https://v8project.blogspot.com/2017/02/high-performance-es20... I made https://github.com/babel/babel-preset-env to make it easier to transit…

Thanks for your excellent efforts hzoo, and of course everyone else involved! The new env preset really makes it much easier to maintain a forward looking code base.

Re: ECMAScript 2016+ in Firefox

#43
post #32

Realistically, when are we going to see the modules situation resolved? ES2017? ES2018? I know, I know, just use a transpiler and emit a bundle... but really? It's been a draft since 2015, and no browsers have any support for it yet, despite full support for the rest of the standard? Are modules really that controversial? I'm kind of disappointed, honestly, that despite all the progress in the ecosystem, this long st…

Preliminary modules supports can be enabled in Firefox Nightly by changing dom.moduleScripts.enabled to true in about:config. There are still some bugs ( https://bugzilla.mozilla.org/show_bug.cgi?id=568953 ) to fix before we can ship this.

What does that flag actually enable? I can't seem to get it to load any modules (even with type="module") - there hasn't been any movement on that bug for a while, and the last comment says "looks like it is only supported for chrome documents"... I know I'm just being impatient, but I'd love to ditch Babel for my own projects and this is my last "must have" ;)

Re: ECMAScript 2016+ in Firefox

#44

Realistically, when are we going to see the modules situation resolved? ES2017? ES2018? I know, I know, just use a transpiler and emit a bundle... but really? It's been a draft since 2015, and no browsers have any support for it yet, despite full support for the rest of the standard? Are modules really that controversial? I'm kind of disappointed, honestly, that despite all the progress in the ecosystem, this long st…

Forget about browsers, have you read the clusterfuck that Node.js is aiming for with ES6 Modules?

https://medium.com/the-node-js-collection/an-update-on-es6-m...

Re: ECMAScript 2016+ in Firefox

#45

Realistically, when are we going to see the modules situation resolved? ES2017? ES2018? I know, I know, just use a transpiler and emit a bundle... but really? It's been a draft since 2015, and no browsers have any support for it yet, despite full support for the rest of the standard? Are modules really that controversial? I'm kind of disappointed, honestly, that despite all the progress in the ecosystem, this long st…

Note to people reading this: module support in this post seems to mostly refer to the loading of modules. The spec is pretty clear about the syntax and semantics of modules, except when it comes to loading which it more or less says is "up to the runtime" to figure out.

There's some interesting (or not, depending on your POV) conversation/debate going on between the nodejs world and the browser world, which are – I suppose – the only two "real" runtime environments where JS is widely used.

There's a lot of effort going into figuring this out, but from a lowly developer point of view it's increasingly frustrating to see that two years on from when the module standard was ratified, we still have to resort to compiling modules to a yesteryear solution such as AMD, CJS, or even globals – or, if you're so inclined, all at once via UMD.

One big issue in figuring this out, as far as I understand it, is determining whether some JS code is ES2015+ or not, since the semantics of loading such a module changes. It may sound simple, but there's plenty of situations where the answer is ambiguous, but picking the wrong answer will result in a change of behavior for older code. Since TC39 is very wary of not breaking backwards compatibility (and kudos to them for it!) simply saying something like "assume ES2015" just won't do.

There was a proposal to change the module semantics to require ES2015 modules to include at least one import or export statement, since these would break in pre-ES2015 runtimes, removing any ambiguity in the syntax. Unfortunately, it seems this proposal is all but dead at this point. (And probably for good reasons I simply don't know about.)

DISCLAIMER: I may well be incorrect about the details in the above, but I think the overall picture is more or less correct.

Re: ECMAScript 2016+ in Firefox

#46
post #32

Earlier quoted context omitted.

Preliminary modules supports can be enabled in Firefox Nightly by changing dom.moduleScripts.enabled to true in about:config. There are still some bugs ( https://bugzilla.mozilla.org/show_bug.cgi?id=568953 ) to fix before we can ship this.

What does that flag actually enable? I can't seem to get it to load any modules (even with type="module") - there hasn't been any movement on that bug for a while, and the last comment says "looks like it is only supported for chrome documents"... I know I'm just being impatient, but I'd love to ditch Babel for my own projects and this is my last "must have" ;)

It was only supported for chrome documents until https://bugzilla.mozilla.org/show_bug.cgi?id=1330657 landed in Firefox Nightly two weeks ago. So if you have a current nightly and set the "dom.moduleScripts.enabled" preference to true in about:config, should work.

Re: ECMAScript 2016+ in Firefox

#47

Realistically, when are we going to see the modules situation resolved? ES2017? ES2018? I know, I know, just use a transpiler and emit a bundle... but really? It's been a draft since 2015, and no browsers have any support for it yet, despite full support for the rest of the standard? Are modules really that controversial? I'm kind of disappointed, honestly, that despite all the progress in the ecosystem, this long st…

Forget about browsers, have you read the clusterfuck that Node.js is aiming for with ES6 Modules? https://medium.com/the-node-js-collection/an-update-on-es6-m...

It really is a shame isn't it? I'm not sure why the unambiguous syntax proposal was shot down – there were good reasons I'm sure – but I thought it was a pretty solid idea.

Re: ECMAScript 2016+ in Firefox

#49

Do any of these changes make the language objectively better? All I see are nice-to-haves that aren't really required.

I think the Array.includes makes the language better as it standardizes how to check for array membership. I've encountered more than one bug as a result of the "!== -1" check not working correctly/as expected.

Re: ECMAScript 2016+ in Firefox

#50

Do any of these changes make the language objectively better? All I see are nice-to-haves that aren't really required.

I've always had a soft-spot for JavaScript, and have written a tonne of it over the years - all these "nice-to-haves" are really nice to have. I find it a lot more fun to write and, more importantly, easier to read six months later (assuming people don't try to be overly tricky with it: I'm looking at you, nested-destructed function parameters!)
Post reply on HN