No subject
Thu Feb 11 18:09:36 PST 2010
responding value on the object being enumerated (e.g., "obj[k]" above), I t=
hink that the more useful interpretation is the one currently employed by T=
raceMonkey and SES5/3.
I think a clarification of this issue be added to the ES5 errata. I propose=
that this clarification adopt the more useful suppression behavior, and su=
ggest that ES5 implementations in progress switch to that behavior. Whichev=
er disambiguation is adopted, I'll be happy to file bugs against the implem=
entations with the non-conforming behavior. We should also add a test for t=
his to es5conform.
--
Cheers,
--MarkM
_______________________________________________
es-discuss mailing list
es-discuss at mozilla.org<mailto:es-discuss at mozilla.org>
https://mail.mozilla.org/listinfo/es-discuss
--_000_90EDC335A511F2479C63F7337D3CE7DB41DF00E3TK5EX14MBXC116r_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<base href=3D"x-msg://213/">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.apple-style-span
{mso-style-name:apple-style-span;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dpurple style=3D'word-wrap: break-wor=
d;
-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'>
<div class=3DSection1>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>I don’t think it is valid to use Object.keys as part o=
f
your definition of for-in because that leaves you with a circular
definition as the specification for Object.keys says it orders the keys in =
the
same order used by for-in.<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>Ignoring algorithms for the moment and simply looking at
semantics, I don’t see how your interpretation makes any sense at all=
. The
semantics of prototype inheritance creates the illusion that inherited
properties are part of the inheriting object unless they are explicitly
over-ridden by an own property. The semantics you describe break this illus=
ion
by essentially allowing the [[enumerable]] attribute of an inherited proper=
ty
to over-ride the [[enumerable]] attribute of a same-named own property.&nbs=
p;
This is essentially the same mistake that the JScript has historically made=
with
ES1-3 when it allowed an inherited dontenum attribute to suppress the
enumeration of a like-name own property. I think there is unive=
rsal
agreement that JScript was wrong in this regard. What you are proposi=
ng
is equally wrong but with the boolean value of the attribute reversed=
.<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>I believe that the correct list of enumerated names for for-=
in
(in the absence of side-effects that modify properties or property
attributes) is:<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'>function getEnumerableNames(obj) {<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'> var encounteredKeys=3D Object.create(null);<o:p=
></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'> var result =3D [];<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'> while (obj) {<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'> Object.getOwnPropertyNames(ob=
j).forEach(function(n)
{<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'> if (!(n in
encounteredKeys)) {<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'> =
encounteredKeys[n]=3Dtrue; <o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'> =
if (Object.getOwnPropertyDescriptor(obj,n).enumerable) result.push(n);<o:p>=
</o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'> =
}<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'> }<o:p></o:p=
></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'> obj=3DObject.getPrototypeOf(o=
bj);<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'> }<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'> return result;<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Courier N=
ew";
color:#1F497D'> }<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'> <o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>This is also the list of names that Object.keys should produ=
ce. The
actual order of the names in the result of the above function is not specif=
ied
by ES5. The prose of 12.6.4 (but not the algorithm) concerning delete=
d
properties means that side-effects that delete properties should be handled=
as
if for-in was then implemented as:<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>getEnumerableNames(obj).forEach(function(n) {if (n in obj) <=
i>execute-for-in-body-with-n</i>});<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>But note that since the order is undefined, if the bod=
y
does any deletes there is no guarantee whether you will or won’=
t
see a key that is subject to deletion. The only guarantee is that if =
all occurrences
of a particular property name (there may be multiple along the prototype ch=
ain)
are deleted before processing that name, then the for-in body will no=
t be
execute for that name. <o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>Things are even more unspecified if properties are added as
side-effects or if enumerable attribute values are dynamically changed.<o:p=
></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>However, I believe the most important use case is the one wh=
ere
there are no evil side-effects in the for-in body. For that case the =
set
of property names for which the for-in body is executed is supposed to be t=
he
set generated by the above getEnumerableNames function.<o:p></o:p></span></=
p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>Allen<o:p></o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style=3D'border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in =
4.0pt'>
<div>
<div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in =
0in 0in'>
<p class=3DMsoNormal><b><span style=3D'font-size:10.0pt;font-family:"Tahoma=
","sans-serif"'>From:</span></b><span
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Oliver Hunt
[mailto:oliver at apple.com] <br>
<b>Sent:</b> Friday, May 07, 2010 10:40 AM<br>
<b>To:</b> Allen Wirfs-Brock<br>
<b>Cc:</b> Mark S. Miller; es5-discuss at mozilla.org; es-discuss; Mike Stay<b=
r>
<b>Subject:</b> Re: Yet more ambiguities in property enumeration<o:p></o:p>=
</span></p>
</div>
</div>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<div>
<div>
<p class=3DMsoNormal>On May 7, 2010, at 10:22 AM, Allen Wirfs-Brock wrote:<=
o:p></o:p></p>
</div>
<p class=3DMsoNormal><br>
<br>
<o:p></o:p></p>
<div>
<div>
<div>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>While 12.6.4 is does not explicitly talk about this case I t=
hink
it implicitly covers it.</span><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'> </span><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>Line 6.a (of the first algorithm, 7.a of the second) says
“Let P be the name of the next property of obj whose [[Enumerable]]
property is true”. </span><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>I don’t believe that there is any other operatio=
n
or function in ES5 that when doing a property access by-passes a own
property based upon some condition and instead accesses as shadowed inherit=
ed
property. Given that it’s pretty clear that the quoted sentence
should be read as if it said “Let P be the name of the next property
accessible via the [[Get]] internal method of obj whose [[Enumerable]] prop=
erty
is true”</span><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'> </span><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>Also note that the final paragraph says “a property of=
a
prototype is not enumerated if it is “shadowed” because some
previous object in the prototype chain has a property with the same
name”. Note this just says “shadowed” which I
believe (I probably wrote it :-) show be interpreted in the accessible via
[[Get]] sense. In particular, it does not say something like ‘h=
as
the same name of a enumerated property of some previous object in the proto=
type
chain”</span><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'> </span><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>Given these two points of the specification, I think it take=
s
some pretty creative interpretation to arrive at the Webkit/V8
interpretation. I suspect, that their behavior is probably an
implementation artifact rather than something intentional. I can ente=
r
the more explicit formulation of (6.a/7.a) into the errata if there i=
s a
consensus that it is really needed, but I think we are also fine without it=
.</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<p class=3DMsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=3DMsoNormal>The JSC implementation is deliberate (and i believe br=
endan
has said that SM will be moving to match it), the interpretation is that
enumeration is a breadth first search of all enumerable properties of an ob=
ject
that are present at the start of iteration, in the order of insertion, skip=
ping
any properties that subsequently disappear from the object.<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=3DMsoNormal>The algorithm (as implemented in JSC and V8) for 'for =
(lhs
in object) S' is essentially:<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=3DMsoNormal>names =3D enumerablePropertyNames(object)<o:p></o:p></=
p>
</div>
<div>
<p class=3DMsoNormal>for (var i =3D 0; i < names.length; i++) {<o:=
p></o:p></p>
</div>
<div>
<p class=3DMsoNormal> if (!names[i] in object)<o:p></o:p=
></p>
</div>
<div>
<p class=3DMsoNormal> continue;<o:p></o:p>=
</p>
</div>
<div>
<p class=3DMsoNormal> lhs =3D names[i];<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal> S<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal>}<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><o:p> </o:p></p>
</div>
<p class=3DMsoNormal>with<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal>function enumerablePropertyNames(object) {<o:p></o:p><=
/p>
</div>
<div>
<p class=3DMsoNormal> var result =3D [];<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal> while (object) {<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal> var keys =3D
Object.keys(object);<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal> for (var i =3D=
0; i
< keys.length; i++) {<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal> =
if
(result.indexOf(keys[i]) !=3D -1)<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal>
continue;<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal>
result.push(keys[i]);<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal> }<o:p></o:p></=
p>
</div>
<div>
<p class=3DMsoNormal> }<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal> return result;<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal>}<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=3DMsoNormal>I'm 99% sure this code is correct, but i just typed it=
into
Mail so there maybe typos<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=3DMsoNormal>--Oliver<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><br>
<br>
<o:p></o:p></p>
<div>
<div>
<div>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'> </span><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>Allen</span><o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'> </span><o:p></o:p></p>
</div>
<div style=3D'border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in =
4.0pt;
border-width:initial;border-color:initial'>
<div>
<div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in =
0in 0in;
border-width:initial;border-color:initial'>
<div>
<p class=3DMsoNormal><b><span style=3D'font-size:10.0pt;font-family:"Tahoma=
","sans-serif"'>From:</span></b><span
class=3Dapple-converted-space><span style=3D'font-size:10.0pt;font-family:"=
Tahoma","sans-serif"'> </span></span><span
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'><a
href=3D"mailto:es-discuss-bounces at mozilla.org">es-discuss-bounces at mozilla.o=
rg</a><span
class=3Dapple-converted-space> </span>[mailto:es-discuss-bounces at mozil=
la.org]<span
class=3Dapple-converted-space> </span><b>On Behalf Of<span
class=3Dapple-converted-space> </span></b>Mark S. Miller<br>
<b>Sent:</b><span class=3Dapple-converted-space> </span>Friday, April =
23,
2010 9:01 AM<br>
<b>To:</b><span class=3Dapple-converted-space> </span><a
href=3D"mailto:es5-discuss at mozilla.org">es5-discuss at mozilla.org</a>; es-dis=
cuss<br>
<b>Cc:</b><span class=3Dapple-converted-space> </span>Mike Stay<br>
<b>Subject:</b><span class=3Dapple-converted-space> </span>Yet more
ambiguities in property enumeration</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<p class=3DMsoNormal> <o:p></o:p></p>
</div>
<div>
<div>
<div>
<p class=3DMsoNormal>Mike Stay (cc'ed) noticed the following ambiguity:<o:p=
></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal>What should the following print?<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> var base =3D {x:8};<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> function showProps(obj) { <o:p=
></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> var result =3D []; <o:p=
></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> for (var k in obj) { <o=
:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> result.push(k, ': ',
''+obj[k], '\n'); <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> } <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> return result.join(''); =
;<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> }<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> var derived =3D Object.create(base,=
{x:
{value: 9, enumerable: false}});<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> showProps(derived);<o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal>Of current ES5 implementations in progress,<o:p></o:p>=
</p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal>* TraceMonkey and SES5/3 (Mike Stay's emulation of the
Secure subset of EcmaScript 5 strict on current ES3R browsers) currently gi=
ves<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> the empty string, <o:p></o:p>=
</p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> meaning that the non-enumerable "x&qu=
ot; in
derived shadows the enumerable "x" from base.<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal>* WebKit nightly and V8 currently gives<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> "x: 9"<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> meaning that the enumerable "x" =
from
base shows through, causing the above loop to look up the value of the
unenumerable shadowing "x" property.<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal>I have not tested any other partial ES5 implementation=
s
(Rhino, ObjectPascal, ??).<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal>The relevant test seems to be ES5 section 12.6.4 step =
6.a
(and likewise 7.a for the next production):<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> Let P be the name of the nex=
t
property of obj whose [[Enumerable]] attribute is true.<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal>From this text, I think either interpretation is possi=
ble.
However, since a common pattern for using for-in uses the enumerated key to
look up the corresponding value on the object being enumerated (e.g.,
"obj[k]" above), I think that the more useful interpretation is t=
he
one currently employed by TraceMonkey and SES5/3. <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3DMsoNormal>I think a clarification of this issue be added to the =
ES5
errata. I propose that this clarification adopt the more useful suppression
behavior, and suggest that ES5 implementations in progress switch to that
behavior. Whichever disambiguation is adopted, I'll be happy to file bugs
against the implementations with the non-conforming behavior. We should als=
o
add a test for this to es5conform.<o:p></o:p></p>
</div>
</div>
<div>
<p class=3DMsoNormal><br>
--<span class=3Dapple-converted-space> </span><br>
Cheers,<br>
--MarkM<o:p></o:p></p>
</div>
</div>
</div>
<p class=3DMsoNormal><span style=3D'font-size:13.5pt;font-family:"Helvetica=
","sans-serif"'>_______________________________________________<br>
es-discuss mailing list<br>
<a href=3D"mailto:es-discuss at mozilla.org">es-discuss at mozilla.org</a><br>
<a href=3D"https://mail.mozilla.org/listinfo/es-discuss">https://mail.mozil=
la.org/listinfo/es-discuss</a><o:p></o:p></span></p>
</div>
</div>
<p class=3DMsoNormal><o:p> </o:p></p>
</div>
</div>
</body>
</html>
--_000_90EDC335A511F2479C63F7337D3CE7DB41DF00E3TK5EX14MBXC116r_--
More information about the es-discuss
mailing list