Hi,

We found possible inconsistencies in the ECMAScript specification and we'd like 
to double check what we've found with experts. :-)

1) absent/present

As "8.6.1 Property Attributes" says, a named accessor property may have four 
attributes: [[Get]], [[Set]], [[Enumerable]], and [[Configurable]].

As "8.10 The Property Descriptor and Property Identifier Specification Types" 
says, "Values of the Property Descriptor type are records composed of named 
fields where each field's name is an attribute name and its value is a 
corresponding attribute value as specified in 8.6.1.  In addition, any field 
may be present or absent."

However, in "8.10.4 FromPropertyDescriptor(Desc)", the steps 4-a and 4-b do not 
check whether [[Get]] and [[Set]] are "present" in "Desc" but just access them. 
 Is it an oversight of the specification or are we missing something here?

We tried the following code:

   var o = { get abc() {} }
   x = Object.getOwnPropertyDescriptor(o, "abc")
   for (y in x) { document.writeln(y); }

where "15.2.3.3 Object.getOwnPropertyDescriptor" calls FromPropertyDescriptor, 
and an online JavaScript interpreter prints the following:

   get set enumerable configurable

which suggests that [[Set]] is "present" even though we didn't define a setter. 
 Calling the setter as follows:

   x.abc(3)

results in the following error:

   TypeError at line NaN: 'undefined' is not a function

which suggests that [[Set]] is "present" and its value is "undefined".

So, we're confused.  When 8.10 says that "any field may be present or absent", 
does the word "absent" mean that the field exists but its value is "undefined"? 
 A similar question is when the step 12 of "8.12.9 [[DefineOwnProperty]](P, 
Desc, Throw)" says "For each attribute field of Desc that is present, ..." does 
the word "present" mean that the field exists and its value is not "undefined"? 
Yet another similar question is the step 2 of "8.10.1 
IsAccessorDescriptor(Desc)": "If both Desc.[[Get]] and Desc.[[Set]] are absent, 
..."

Finally, when the step 2 of "8.10.2 IsDataDescriptor(Desc)" says "If both 
Desc.[[Value]] and Desc.[[Writable]] are absent, then return false." we might 
be able to say that Desc.[[Value]] is absent if its value is undefined, but how 
about Desc.[[Writable]]?  Its type is Boolean and its default value is false.  
Does the specification say that Does.[[Writable]] is absent if its value is 
false?


2) LabelledStatement

The first paragraph of "12 Statements" says "A LabelledStatement has no 
semantic meaning other than the introduction of a label to a label set."  
However, "12.12 Labelled Statements" says that "If the result of evaluating 
Statement is (break, V, L) where L is equal to Identifier, the production 
results in (normal, V, empty)."  This might be a picky comment but I think 
because of the sentence in 12.12, a LabelledStatement has some semantic 
meaning. :-)


3) Arguments Object

"10.6 Arguments Object" says "When control enters an execution context for 
function code, an arguments object is created unless (as specified in 10.5) the 
identifier arguments occurs as an Identifier in the function‘s 
FormalParameterList or occurs as the Identifier of a VariableDeclaration or 
FunctionDeclaration contained in the function code." which suggests that if 
there is a variable named "arguments" in a function body then it does not 
create the name "arguments".  However, in 10.5, variable bindings in a function 
body is handled in the step 8 and checking the name "arguments" is in the step 
6, so even though the function body declares a variable of name "arguments" the 
name "arguments" is created.  We found them inconsistent.  What do you think?

Thank you for your comments in advance!

Best,
--
Sukyoung

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to