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

Sean Eagan seaneagan1 at gmail.com
Mon Jul 18 13:39:32 PDT 2011


On Mon, Jul 18, 2011 at 1:44 PM, Allen Wirfs-Brock
<allen at wirfs-brock.com> wrote:
>> Also, how about |> as opposed to <&, since it is a dual to <| adding
>> own rather than inherited properties?
>
> I'd be a bit concerned about  some people getting confused about which direction of the "arrow" corresponds to each operation.

I think the arrow-to-operator correspondence would be fairly easy to
remember... "extension arrows point back in space to prototypes which
exist back in time , and forward in space to own properties which will
exist forward in time".

>
> I like the nemonic value of having + or & as part of the operator symbol for "extend" but  unfortunately <+ can't be used.

One thing to note is that <& would disallow using & as a unary
operator in the future.

Here's another option to consider:

// replace <| with <>
let B = A <> {...}; // looks like a (prototype) chain link
// then +> could make sense
let b = B +> {}; // "adding" pointed to properties.


Thanks,
Sean Eagan


More information about the es-discuss mailing list