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

Brendan Eich brendan at mozilla.com
Tue Jul 19 11:07:52 PDT 2011


On Jul 19, 2011, at 10:20 AM, Brendan Eich wrote:

> On Jul 19, 2011, at 10:06 AM, Dmitry A. Soshnikov wrote:
> 
>> Object.extend(src, dest)

Oops, except you have the arguments tranposed (thanks to shaver for pointing this out to me).

  Object.extend(dst, src)

or

  import extend from "@obj";
  extend(dst, src);

Any mutating function should take uncurried "this" as first parameter. Separate argument: strcpy/memcpy/memmove from Unix libc all imitate assignment by copying right to left. Anything else is a sanity challenge (I've had to deal with gdb vs. Intel x86, which disagree on this [gdb is wrong] for way too long).

/be

> 
> This is certainly closest to paving the cowpath. Either via a built-in module exporting 'extend', or as you suggest, directly on Object. The Object.extend route is a bit harder to analyze, but not fatally so for any capable static analysis framework.
> 
> Either way (built-in module or Object.extend), old script (Hi Luke! ;-) could use it too.
> 
> /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