An experiment using an object literal based class definitionpattern

Claus Reinke claus.reinke at talk21.com
Tue Aug 9 01:29:37 PDT 2011


> .. the key extensions I used in the collections experiment are:
> ..
>   *  the <| operator -- defines the [[Prototype]] of a literal
>   *  the .{ operator -- extends the LHS object with properties from an 
> object literal

How do these two relate to (non-destructive) object extension operators
[1]?  The syntax mentioned there would line up with array spreads:

    { properties , ...: obj }
     // returns copy of obj, extended with properties

If that is the same idea, then it is something I'd like to see [2]. Both
syntax variations share the limitation to literal extension properties,
the spread variation is more conventional and tends to be suitable
for both construction and destructuring (also, one could write the
extended object at the front or at the back), so it might be preferable?

It seems that <| is merely a special case, aiming to avoid naming 
[[Prototype]], right?

Claus

[1] http://wiki.ecmascript.org/doku.php?id=harmony:destructuring#issues
[2] https://mail.mozilla.org/pipermail/es-discuss/2011-June/015475.html
 


More information about the es-discuss mailing list