ES4 draft: Object
P T Withington
ptw at pobox.com
Fri May 16 05:02:34 PDT 2008
On 2008-05-15, at 18:48 EDT, Garrett Smith wrote:
> That sore thumb propertyIsEnumerable.
>
> propertyIsEnumerable, as a setter, sets the DontEnum flag for the
> object's own property. A value of 'false' makes the prop not show up
> in - for in.
> propertyIsEnumerable, as a getter, gets the value of the negation of
> the DontEnum flag, and does not check the prototype chain. Has nothing
> to do with whether or not the object shows up in - for in.
>
> The addition adds a non-orthogonal aspect, apparently to add some
> needed functionality.
>
> This unituitive behavior is especially problematic to amateur, or
> unskilled developers. The following code example from google
> demonstrates this to be true:
[...]
Is a virtual property (one defined by a getter/setter pair) enumerable?
Is Object.prototype.propertyIsEnumerable required to be generic? Can
it be applied to a non-Object (a native DOM object)?
OpenLaszlo struggles with this sore thumb too. I hadn't even
considered that someone might replace Object methods. Check out
`objectOwnProperties`, the last function in (LzDebug)[http://svn.openlaszlo.org/openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzDebug.lzs
].
More information about the Es4-discuss
mailing list