reserved keyword const as defined in Javascript 1.5: "You can create a read-only, named constant with the const keyword. The syntax of a constant identifier is the same as for a variable identifier: it must start with a letter or underscore and can contain alphabetic, numeric, or underscore characters." http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Constants Testcase: http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/JSConstKeyword.html Steps: type in a number (say, 1) in the radius input text and then press the "Calculate perimeter of circle" button Actual results in Konqueror 4.1: NaN shows up in the "Perimeter of the circle" input Expected results: 6.28 should show up in the "Perimeter of the circle" input Component could be kjs or khtml; I am not sure. Regards, Gérard
Confirm regression in KJS4.1, for global scope (and other symbolics) --- [[Put]] simply fails since ReadOnly is set. We need special codegen on execution for ReadOnly things, and it is quite a bit of a mess since we don't want to override readonly in general, so it needs to make sure it's bound to the proper lexical scope. OTOH, it'll likely get more Mozilla-like semantics doing that. WRT to the report, though, I must point out, however, that "JavaScript 1.5" is merely the name for the non-standard dialect supported by Mozilla, and is in no way, shape, or form a standard, and has quite a few extensions. The relevant standard is ECMAScript 3 (ECMA 262-3), which does not list such a construct. The upcoming version 3.1 will include const, as well as many other vendor extensions other implementations pretty much had to implement for compatibility anyway.
> has quite a few extensions. The relevant standard is ECMAScript 3 (ECMA 262-3), which does not list such a construct. Ok, I missed that. "const is a Mozilla-specific extension (...)" http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/const#Description Regards, Gérard
Section 15.2.3.9 of ECMAScript 3.1 (final draft, candidate specification of ECMAScript, ECMA-262, 5th edition, April 2009) http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf at page 108 states: { Section 15.2.3.9 Object.freeze ( O ) When the freeze function is called, the following steps are taken: 1. 2. If Type(O) is not Object throw a TypeError exception. For each named own property name P of O, a. Let desc be the result of calling the [[GetOwnProperty]] internal method of O with P. b. If IsDataDescriptor(desc) is true, then i. If desc.[[Writable]] is true, set desc.[[Writable]] to false. c. If desc.[[Configurable]] is true, set desc.[[Configurable]] to false. d. Call the [[DefineOwnProperty]] internal method of O with P, desc, and true as arguments. 3. Set the [[Extensible]] internal property of O to false. 4. Return O. } therefore replacing const as reserved keyword. { ES3.1 proposes two functions for placing objects into such locked-down states. Object.seal fixes the definitional state of its argument object. It does this by setting the configurable attribute of each own property to the false state. In addition, it marks the object such that additional properties cannot be added. Object.freeze performs the same actions as Object.seal. In addition, it sets the writable attribute to false for every own data property of the object. ES3.1 also provides Object.isSealed and Object.isFrozen functions for query whether or not an object is in one of these locked-down states. Various alternative names such as “fix” and “const” were proposed and considered as names for the two lock-down states. The final names were chosen because it was felt that the selected terms had the greatest cognitive distance between them and hence would be less subject to confusion. } coming from Proposed ECMAScript 3.1 Static Object Functions: Use Cases and Rationale (Revised August 26, 2008) http://74.125.45.132/search?q=cache:wqc09mW4jr8J:wiki.ecmascript.org/lib/exe/fetch.php?id=es3.1%3Aes3.1_proposal_working_draft&cache=cache&media=es3.1:rationale_for_es3_1_static_object_methodsaug26.doc+ECMAScript+3.1+const&hl=en&ct=clnk&cd=1&gl=us So, const is not part of the current spec and will not be part of ECMAScript 3.1. Resolving as INVALID