[Webkit-unassigned] [Bug 31813] Add support for block scope const

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 16 10:54:00 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=31813





--- Comment #4 from Erik Arvidsson <arv at chromium.org>  2011-11-16 10:53:59 PST ---
(In reply to comment #1)
> 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.

Please read the latest draft before you start.

http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts

There is no sentinel and const declaration requires an initializer.

ConstDeclaration :
  const ConstBindingList ;

ConstBindingList :
  ConstBinding
  ConstBinding List , ConstBinding

ConstBinding :
  BindingIdentifier Initialiser
  BindingPattern Initialiser

 The draft spec does not yet cover const in for, for-in and for-of loops.

The URL of this bug points to the wiki page which clearly states that there is no temporal dead zone.

> 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.

Also, in Harmony there is no global object like that. Global variables does not create properties on global.

-- 
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