User:Shaver/ES4 FAQ

From MozillaWiki
Jump to navigation Jump to search

If browsers implement ES4, will it break my existing scripts?

Almost certainly not.

The ECMA committee chartered to develop and maintain the ECMAScript specification, known as "TG1", has taken compatibility with existing scripts as their number one priority. The vast majority of features in ES4 which could conflict with, or change the meaning of, existing ES3 (JS1.x) scripts aren't available unless the script author explicitly opts into them.

There are several categories of changes introduced in ES4 which can affect existing ES3 code:

  • opt-in facilities such as new keywords, which will not affect programs unless the new ES4 capabilities are explicitly requested
  • bug fixes to match prevailing (often: all) browser support, such that the specification better reflects what developers can actually expect from implementations; programs that run in the real world today will be unaffected, obviously, as this is codification of existing practice
  • bug fixes to match user expectation, where the ES3 behaviour was a trap for the unwary, and not useful in its specified form; the classic example is how this is bound in nested functions, which is one of the most confusing and anger-inducing defects in the ES3 specification.

A complete description of all incompatibilities between ES4 and ES3 (as specified; note again that many of the changes represent codification of what is actually implemented in virtually all engines) is available at XXX.

Do I have to upgrade all my script to ES4 at once?

No.

Significant effort has gone into ensuring that ES4 code and ES3 code can interoperate simply, including preservation of argument types and values when ES4 values pass through ES3 functions and scripts. You can upgrade your code piecemeal as you need and want to use new ES4 capabilities, and don't need to give up your existing ES3 libraries or application code to do so.

Who is designing ES4?

The ECMA TG1 committee has as member companies Adobe, Apple, Opera, Mbedthis, Microsoft, Mozilla, and Yahoo!; of these, all but Apple have been active in the ES4 process over the past two years, with Apple joining the committee activities much more recently. The current draft specification is opposed by Microsoft and Yahoo!, and they have not contributed significantly to the specification.

In addition, there are several invited experts in the fields of type theory and programming language design who participate actively in the design of the language and have helped tremendously in the production of what the majority of committee members believe is a robust specification.

Does everyone agree on the current draft ES4 specification?

No.

Of the active members, Microsoft and Yahoo! are opposed to the current state of the specification, and have expressed belief that ES4 is too big a language, is incompatible with the web, or is otherwise unsuitable for ratification as a successor to ES3. As of this writing, there is no alternative ES4 proposal ready for review by TG1.

Will ES4 require me to specify types, or stop changing the properties of my objects dynamically, as I do today with ES3?

No.

Even if an author opts into ES4's syntax-incompatible features as mentioned above, it's still up to them to use types, various "fixed binding" features such as classes and intrinsics, and any other ES4 feature as they choose. All the dynamism of ES3 is still available to script authors, but they will now also have options for reducing that dynamism or placing restrictions on how their code can be used, in order to improve security, performance, and reliability of their applications.

Are there implementations of ES4?

There are no complete implementations of ES4 as of this writing. The TG1 committee is building a reference implementation in parallel with development of the specification, as a means of proving out various design decisions and providing a tool (albeit a slow one) for developers to use in exploring the language. The Tamarin project is another open-source ES4 implementation, which is being developed chiefly by Mozilla and Adobe for use in future Firefox and Flash Player products. There may be other ES4 implementations underway internal to different organizations, as well.