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

Brendan Eich brendan at mozilla.com
Tue Jul 19 10:02:50 PDT 2011


On Jul 19, 2011, at 7:44 AM, Sean Eagan wrote:

> On Tue, Jul 19, 2011 at 9:39 AM, Sean Eagan <seaneagan1 at gmail.com> wrote:
>> // replace <& with "owns"
>> let b = B owns {
> 
> Sorry, that should have just been...
> 
> B owns {
>  ...
> }

B conquers {...}

Half-kidding. The mutating aspect still bothers me. Indeed it seems to have tripped you up too, since you wrote:

  let b = B owns {...}

as if owns were a pure operator.

If we are paving the "extend" cowpath, a function is the better paving material:

  import extend from "@obj"; // or @core or whatever

  extend(B, {...});

is completely unambiguous and no harder to analyze for a static program analysis tool that can parse ES.next than <&.

/be


More information about the es-discuss mailing list