ES4 draft: Object

Mark S. Miller erights at google.com
Mon Mar 10 23:35:10 PDT 2008


On Mon, Mar 10, 2008 at 11:14 PM, Maciej Stachowiak <mjs at apple.com> wrote:
> [...] I'd like to propose the following three alternatives to the
>  current proposal:
>
>  1) Remove the feature entirely from ES4 (as part of the "judicious
>  feature cuts" process) until a more appropriate syntax is found
>  2) Replace two-argument form of propertyIsEnumerable with
>  setPropertyIsEnumerable
>  3) Replace two-argument form of propertyIsEnumerable with
>  __setPropertyIsEnumerable__

So long as setPropertyIsEnumerable is a method of Object.prototype, it
raises the otherwise pointless question of the meaning of overriding
it. At the last ES3.1 face-to-face, we agreed instead on the following
static method on Object, as recorded at
<http://wiki.ecmascript.org/doku.php?id=es3.1:targeted_additions_to_array_string_object_date>:

-------------------------
Object.dontEnum(object, memberName)

The own property memberName of object is marked to be excluded for the
for in enumeration.

If a new object is made that delegates to object, the new object may
create and change its own memberName property, and that property will
be enumerable.
-------------------------

That page also lists static methods on Object to set the attributes
DontDelete and ReadOnly. The proposed static Object.fix(obj) is
inspired by proposed ES4's notion of a fixture -- a non-dynamic
object. Such static methods allow most of the restrictions associated
with ES4's classes to be expressed without new syntax or major new
concepts.

-- 
    Cheers,
    --MarkM



More information about the Es4-discuss mailing list