Overloading bitwise operators, which is pretty easy to determine? var parent = { prop1: parent1 };
inherit + overrides var obj = parent | { prop1: newValue1, inherit2 : inherit2 } = { prop1: parent1, prop2: inherit2 } inherit - overrides var diff = proto & { prop1: newValue1: prop2: value 2 } = { prop1: newValue1, prop2: val2 } I already use constants in this way to represent complex preset objects; var flags = [ 'PRIVAVTE', 'ENUMERABLE', 'CONFIGURABLE', 'READONLY', 'WRITABLE', 'FROZEN', 'HIDDEN', 'NORMAL', ]; var flags = { get name() return flags[this.enumerable | this.configurable << 1 | this.writable << 2] }, set name(){ this.configurable = Boolean(v & CONFIGURABLE); this.enumerable = Boolean(v & ENUMERABLE); this.writable = Boolean(v & WRITABLE); } } On Sat, Mar 3, 2012 at 5:24 AM, Axel Rauschmayer <a...@rauschma.de> wrote: > More possibilities (Alas, <* does not work, because the asterisk is not > vertically centered in some fonts), in order of preference (the first one > has already been suggested, but AFAIK not been rejected, yet). > > let sub = sup <: {p:1, q:2}; > let sub = sup <~ {p:1, q:2}; > let sub = sup <> {p:1, q:2}; > let sub = sup >< {p:1, q:2}; > > > On Mar 3, 2012, at 7:00 , Brendan Eich wrote: > > > I'm with Luke here. We shouldn't abuse a common idiom from other > languages, including upstream ones such as CoffeeScript. > > > > Kris's suggestion of +> changed to deal with the "wrong direction" > criticism (which I find compelling since the [[Prototype]] property is a > reference): > > > > let sub = sup +< {p:1, q:2}; > > > > (E4X ambiguity, no worries.) > > > > Comments? > > -- > Dr. Axel Rauschmayer > a...@rauschma.de > > home: rauschma.de > twitter: twitter.com/rauschma > blog: 2ality.com > > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss