15

I noticed that v8 is rather mute on the issue of ECMAScript 5th edition.

V8 implements ECMAScript as specified in ECMA-262, 3rd edition, and runs on Windows XP and Vista, Mac OS X 10.5 (Leopard), and Linux systems that use IA-32 or ARM processors.

Even the bug tracker seems quiet...

On one bug you can find a commiter writing this:

V8 is an implementation of ECMAScript, not JavaScript. The latter is a non-standardized extension of ECMAScript made by Mozilla. V8 is intended to be plug-in compatible with JSC, the ECMAScript implementation in WebKit/Safari. As such it implements a number of non-standard extensions of ECMAScript that are also in JSC, and most of these are also in Mozilla's JavaScript languages. There is no plan to add non-standard features that are not in JSC to V8.

Interestingly enough he wrote that on Oct 8, 2010, when ECMAScript 5 was published on December 2009, and two months earlier Javascript 1.8.5 -- a superset of ECMAScript 5 -- was released.

So the question remains when will Google update v8 to run on ECMAScript 5th edition? Is there even a plan to upgrade to the latest standardization of ECMAScript?

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
  • Just because I can't find a stance, doesn't mean you can't. Or, that a developer wouldn't know. – Evan Carroll May 25 '11 at 22:45
  • 4
    @Matt Ball P.S. If you don't like the question -- downvote it. But, don't flag it as "not a real question" just because you don't like it. That's an abuse of the system. The question is quite real, and not vague, and easily and objectively answered, "When will v8 implement ECMAScript 5?". – Evan Carroll May 25 '11 at 22:49
  • 1
    And if the V8 _team_ doesn't have the answer? – Matt Ball May 25 '11 at 22:51
  • 3
    You assume the answer can only come from the v8 team? It could be in a Google EDU video, or it could come from a presentation at NodeConf 2011... Who knows? Presumably someone. It certainly isn't the burden of the questioner or the community to ensure that all questions asked are soluble by a non-team member. If you don't like the question then downvote it, or ignore it. Eventually it will get answered, or peacefully not get answered. – Evan Carroll May 25 '11 at 22:55

1 Answers1

27

ECMAScript 5 was actually designed in such way so that implementations don't need to be "updated to run" on it.

There are few changes in existing behavior but mainly ES5 adds new native objects (e.g. Object.create, Array.prototype.map, String.prototype.trim, etc.) and standardizes some of the existing de-facto features (from ubiquitous "line terminators in string literals", "property access on strings", and "indirect eval behavior" to less popular "accessors" and array/string extensions).

The biggest change in behavior — strict mode — was made opt-in for the very same reason; to make transition from ES3 to ES5 less painful.

Having said that, V8 does implement a noticeable chunk of ES5 features, including strict mode (one of the recent additions).

If you look at my ES5 compat. table you can see ES5 features implemented in Chrome — which should closely (and I would think — completely) correlate to V8.

You can also see that support for strict mode is largely implemented in Chrome which means that it should be in V8 as well. To double check, I just ran this code in console (v8 v3.2.3.1) and got SyntaxError as expected:

> (function(){"use strict"; with({x:1}) return x})()
(shell):1: SyntaxError: Strict mode code may not include a with statement
(function(){"use strict"; with({x:1}) return x})()
                          ^^^^

So there you have it. V8 definitely implements majority of ES5 features, including strict mode ;)

kangax
  • 38,898
  • 13
  • 99
  • 135
  • 10
    Did I mention that your ECMAscript5 compat table is totally awesome? Saw it already some time ago when a similar question popped up.. +1 ! – Tigraine Jul 04 '11 at 21:44
  • 3
    No `with` statement! This is why we can't have nice things. A few thousand people misuse a language feature, ruining it for the rest of us. – Michael Lorton Aug 17 '11 at 15:16
  • 1
    @Malvolio Yes! I feel you. `with` has its uses, and it was nice for a few cases (such as [this](http://stackoverflow.com/a/1462102/124119)). But I gotta admit it was dangerous in the wrong hands. – Camilo Martin Oct 02 '12 at 19:16