
Final draft of ECMA-262 (ECMAScript 3.1) has been published - IsaacSchlueter
http://www.ecma-international.org/news/PressReleases/PR_Ecma_finalises_major_revision_of_ECMAScript.htm
======
AndrewO
I thought this release was supposed to have ActionScript style optional type
annotations and classical inheritance. Not to say I'm sad to not see them here
(JS being dynamic and prototypal seems nicer to me), but anyone know what
happened to those?

~~~
olavk
The latest official ECMAScript standard is ECMAScript 3rd edition from 1999.
Since then there have been several attempts to create an upgrade, known as
ECMAScript 4. For example ActionScript 3 and Microsofts JScript.Net is
actually based on an abandoned ECMAScript 4 proposal from around 2000-2003, a
spec that way heavily influenced by Java. A new ECMAScript 4 effort started a
few years ago with Brendan Eich as editor, which was more inspired by dynamic
and functional languages.

However the new ECMAScript 4 spec was pretty large and ambitious, and some
parts of the working groups called for a lesser, incremental spec release to
fix some of the most needed fixes. This proposal was called ECMASCript 3.1.
Then it was decided to scale the ambitious ECMAScript 4 spec back, and this
scaled back version (which is still in flux) is called ECMAScript Harmony.

Now ECMAScript 3.1 has been released, but they have decided to give it the
official name ECMAScript 5th edition, thereby leapfrogging the 4th edition!
This might be because "ECMAScript 4" have gotten a bad name because of the
several failed attempts. Also, it is obviously confusing when widely different
specs gets the same name.

Harmony will then probably be 6th edition, and if some of the features from
ES4 which was culled from Harmony appears in a later spec, it might be in 7th
edition!

~~~
AndrewO
Ah yes, that rings a bell—thanks for the thorough refresher!

------
gord
Has anyone digested this to summarize the significant changes/improvements?

~~~
halo
A quick look. I may have got a few details wrong, since the standard is rather
terse:

JSON support (adds Internaltype.prototype.toJSON, JSON.parse and
JSON.stringify).

Object.create now exists, allowing you to create an object from another
object's prototypes and, optionally, a set of properties (i.e. equivalent to
var constructor = { }; var blah = new constructor(); blah.prototype =
originalobject.prototype;). JavaScript has been crying out for this for years.

There's also ways of preventing modifications to objects
(Object.preventExtensions, Object.seal, Object.freeze) and ways to check them
(Object.isFrozen, Object.isExtensible and Object.isFrozen).

Data objects have new properties: writable (i.e. whether something is read
only), enumerable (i.e. whether it appears in a for-in loop) and configurable
(i.e. whether deletable).

It now exposes most internal properties of objects via
defineProperty/defineProperties, getOwnPropertyNames, getOwnPropertyDescriptor
and hasOwnProperty. I think this is what it does anyway: it seems a little
subtle when combined with the interaction of prototypes. One subtlety is that
it provides syntax for interaction with the properties of HTML elements.

I believe it has warm Microsoft support and IE8 already implements large parts
of this standard, so it's going to be usable sometime in the future.

~~~
anamax
> enumerable (i.e. whether it appears in a for-in loop

Huh? I can see "can appear in a for-in loop", but "appears" is different and
I'm not sure why I care or what it even means means. (Appears when is one
question.)

~~~
halo
I meant "whether it can appear". Apologies for any confusion.

------
andreyf
I wish people would listen to Steve Yegge about marketing...

<http://blip.tv/file/319044/>

...and call this one "Harmony".

~~~
olavk
Harmony is the code name for the version after this one.

------
olavk
They changed the version name to 5th edition, thereby skipping the 4th
edition.

