ES4 draft: Object initializers

liorean liorean at gmail.com
Thu Mar 20 17:12:37 PDT 2008


On 21/03/2008, Lars Hansen <lhansen at adobe.com> wrote:
> I've attempted to sum up everything we have decided about object
>  initializers (aka object literals).  A short draft spec is included.
>  Comments welcome from everyone, especially from ES4 WG members who might
>  remember about things I've forgotten, or correct misunderstandings.

Just a few ideas, I think there's a few declarative features I'd like
to see added:
- I'd *really* like to see some declarative syntax for setting
{DontEnum} flag on properties in object initialisers.
- A declarative way to set catch-alls.
- A declarative way to set the [[Call]] property.
- And maybe declarative way to set the [[Prototype]] property. (This
would of course be const.)


    var
        a={
            dontenum toString: function()'[object customObj]'
            },
        b={
            [[Prototype]]: a,
            [[Call]]: function()...,
            get *: function(propname)...,
            set *: function(propname, value)...,
            ...
        };

The brackets for syntax would from what I can tell work here, since
they are syntax errors in ES3. Or using some double keyword syntax I
guess.
-- 
David "liorean" Andersson



More information about the Es4-discuss mailing list