[Webkit-unassigned] [Bug 31813] Add support for block scope const
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Nov 16 06:48:26 PST 2011
https://bugs.webkit.org/show_bug.cgi?id=31813
Andy Wingo <wingo at igalia.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |wingo at igalia.com
--- Comment #1 from Andy Wingo <wingo at igalia.com> 2011-11-16 06:48:26 PST ---
I would like to implement this, so if you don't mind I will use this bug for stating the requirements, coming to a strategy, and fleshing out an implementation.
To summarize, there are currently two ES modes:
* Strict
* "Classic" (non-strict)
ES.next adds a third:
* "Harmony"
In classic mode, `const' has no specification. In JSC it is like `var', and hoisted to function scope.
In strict mode, `const' is a syntax error.
In harmony mode, `const' is block-scoped, with a so-called "temporal dead zone": when the var is first made, it is logically populated with some sentinel value. If the var is accessed before it is set, that is a runtime error. If it is set twice, that is a runtime error. In some cases the compiler can elide the temporal dead zone, but not in general.
There are also some wrinkles that in top-level strict contexts, `const' should create non-writable, non-configurable properties. Full details on the linked page.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list