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

Sean Eagan seaneagan1 at gmail.com
Tue Jul 19 07:39:02 PDT 2011


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.

> 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.

> and <> historically means not equal or unordered.

True, and it also looks like a diamond which some might associate with
multiple inheritance.  A better "prototype chain" analogy might be ><
since the operands themselves would then serve as the chain links
being linked together...

let B = A >< {
  ...
};

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 {
  ...
};
// replace <& with "owns"
let b = B owns {
  ...
};


Thanks,
Sean Eagan


More information about the es-discuss mailing list