ES6 plans: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
Line 90: Line 90:
* A few functions for [http://wiki.ecmascript.org/doku.php?id=harmony:iterators iterating over object properties]
* A few functions for [http://wiki.ecmascript.org/doku.php?id=harmony:iterators iterating over object properties]


== Mistakes ==
== Incompatible changes ==
Harmony will include a handful of unnecessary breaking changes that can't be detected statically. Oh well.
Harmony may change some ES1-5 behavior, if it empirically turns out to be doable without breaking the Web.
* [http://wiki.ecmascript.org/doku.php?id=harmony:completion_reform Change how eval decides which value to return]
* [http://wiki.ecmascript.org/doku.php?id=harmony:completion_reform Change how eval decides which value to return]
* typeof null == "null" with Harmony opt-in - [https://bugzilla.mozilla.org/show_bug.cgi?id=651251 bug 651251]
* typeof null == "null" with Harmony opt-in - [https://bugzilla.mozilla.org/show_bug.cgi?id=651251 bug 651251]

Revision as of 20:59, 18 January 2012

New and improved builtin APIs

Most of this stuff does not need to touch a lot of code. None of it requires a Harmony opt-in. This is great stuff for new contributors to start work on.

New syntax (stuff that affects the front end and/or bytecode)

This stuff isn't terribly hard either, for the most part.

Updating SpiderMonkey extensions to the ES6 spec

We've implemented a ton of stuff, dating back years, that is going to be in ES6 but in a slightly different form.

Direct proxies

There is a ton of verbiage here and it is still under active development. Still, I think it should be pretty easy to implement. We already have the forwarding code. We can keep Proxy.create and createFunction without a lot of extra effort.

Bug 703537.

Generators and comprehensions

let, const, and block functions

Block scoped bindings

  • Top-level let shouldn't be the same thing as var, per dherman: bug 589199
  • TC39 is specifying that reading a let-variable before it is initialized is an error, which will be a separate bug.
  • const - bug 611388
  • Block functions - bug 585536 (note - opt-in only, still banned in ES5 strict mode)
  • Destructuring

Harmony infrastructure

Some minimal steps here are a prerequisite to doing the features that require a Harmony opt-in: modules and import, block-scoped functions, typeof null, and lexical scoping of names declared at toplevel.

  • New SM version number - This is enough to get started on harmony features with only shell tests.
  • Opt-in via type="text/ecmascript;version=6" or whatever - bug 694107
  • Per-script opt-in syntax ('use harmony;' or whatever)
  • Opt-in via HTTP header?
  • Whole-page opt-in via HTML feature?

Modules

harmony:modules

Modules are bug 568953.

  • module syntax, scoping semantics, module objects
  • import syntax
  • from "url" syntax
  • Hook up from "url" and async module loading to Gecko
  • Module loaders

With a Harmony opt-in, programs get very different global binding behavior. The bindings are no longer shared with the global object's properties. This is a major change.

New APIs that are in modules

Incompatible changes

Harmony may change some ES1-5 behavior, if it empirically turns out to be doable without breaking the Web.

Proposals that should not create any work for us