An "extend" operator is a natural companion to <|

Dmitry A. Soshnikov dmitry.soshnikov at gmail.com
Tue Jul 19 10:06:44 PDT 2011


On 19.07.2011 20:59, Brendan Eich wrote:
> On Jul 19, 2011, at 7:39 AM, Sean Eagan wrote:
>
>> On Mon, Jul 18, 2011 at 4:01 PM, Brendan Eich<brendan at mozilla.com>  wrote:
>>>> // replace<| with<>
>>>> let B = A<>  {...}; // looks like a (prototype) chain link
>>> How so?
>> I'm talking about visual similarity with an actual physical chain link.
> Very visual -- but my mind's eye sees something more like (=) in the right font to line up the round bracket tips with the equals bars...
>
> Reasoning about ASCII art, especially with too few chars, is perilous.
>
>
>>> That link is unidirectional. I don't buy it,
>> I'm thinking of it as "the pre-existing (prototype) properties go
>> before the new (own) properties", in other words the spatial and
>> temporal order of the properties matches.
> Definitely want the prototype object on the left of<|. Not sure what else to say.
>
>
>> However, I agree with your comment in another post that contextual
>> keywords are worth considering even though they introduce restricted
>> productions.  If we were to go that route, I would propose:
>>
>> // replace<| with "prototypes"
>> let B = A prototypes {
>>   ...
>> };
> That does seem like the keyword to use. It's long, though.
>
>
>> // replace<&  with "owns"
>> let b = B owns {
>>   ...
>> };
> "owns" is ambiguous -- could still delegate. Can't use "extends", the direction is wrong (and "extendedBy" is right out!). How about
>
>    let b = B copies {...};
>
> ?
>
> There must be a better contextual keyword...
>

mixin

or even

Object.extend(src, dest)

Dmitry.

> /be
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list