Indexed string pseudo properties and for-in, was RE: Comments on April ES5 final draft standard tc39-2009-025

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Tue Apr 28 09:23:13 PDT 2009


You may be right, that an additional note is warranted.  However, being in a contentious mood I'll also argue that these are indeed properties of string objects.  If [[GetOwnProperty]](P) says P is a property that then it really is one.  In other words:
	P is the name of a own property of O iff O.[[GetOwnProperty]](P) is not undefined
that is pretty much exactly how Object.prototype.hasOwnProperty(V) is defined.

The hole in the spec. seems to be that a few places (for-in, Object.keys, etc.) we use informal language to enumerate an object's properties.  We probably need a more formal definition that incorporates the above rule. 

Allen

>-----Original Message-----
>From: Mark S. Miller [mailto:erights at google.com]
>Sent: Monday, April 27, 2009 6:59 PM
>To: Allen Wirfs-Brock
>Cc: es5-discuss at mozilla.org; es-discuss at mozilla.org
>Subject: Re: Indexed string pseudo properties and for-in, was RE:
>Comments on April ES5 final draft standard tc39-2009-025
>
...
>I'm happy with that, so long as it's consistent with the definition of
>for-in. However, the only relevant text I could find in for-in is
>
>> Let P be the name of the next property of obj whose [[Enumerable]]
>attribute is true. If there is no such property, return (normal, V,
>empty).
>
>Since these indexes are not actually properties of strings, this text
>is insufficient.
>
>--
>    Cheers,
>    --MarkM



More information about the es-discuss mailing list