On Wed, Oct 5, 2011 at 8:44 PM, Brendan Eich <bren...@mozilla.com> wrote:

> On Oct 5, 2011, at 8:21 PM, John J Barton wrote:
>
> I think what's missing is Object.extend:
>
> http://www.prototypejs.org/api/object/extend
> http://api.jquery.com/jQuery.extend/
> http://dojotoolkit.org/reference-guide/dojo/extend.html
>
> http://docs.sencha.com/ext-js/4-0/source/Object2.html#Ext-Object-method-merge
>
> http://code.google.com/p/fbug/source/browse/branches/firebug1.9/content/firebug/lib/object.js
>
> just some examples in a few minutes. With extend, then we can write
>
> var bar = Object.extend(Object.create(aMethodList), aPropList);
>
>
> I agree we should specify Object.extend in ES6. It's the API form of the .{
> "monocle-mustache" operator but generalized to non-literal RHS.
>
> However, IIRC PrototypeJS uses for-in and does not filter out enumerable
> inherited properties. It also uses assignment. Neither is good for ES6. We
> want only "own" properties, including private-name-object-keyed ones. This
> is good motivation for a built-in.
>

PrototypeJS (and Firebug) pre-date Object.keys() and .hasOwnProperty(), so
their implementation was just what could be done, not what was desired.

Trait.create() parallels Object.create() and I gather that Trait.compose()
resembles proposed Object.extend(). I wonder if the traits.js
'parallel-universe' could be applied to Trait.resolve(). In my experience
resolve() isn't needed, but academic work on traits suggests otherwise, so
it might be a good thing to investigate.

jjb


>
> Given Object.extend, does .{ pay for itself outside of the class pattern
> use-case? Does a play on dot connote the mutation of the LHS? I think "maybe
> not" and "no". If we have only Object.extend, we still roll up a popular and
> common de-facto standard. If we must have an operator, it should take
> non-literal RHS and contain = in the assignment operator style. So, .=
> (monocle-nostrils? monocle-thin-man-mustache? ugh).
>
> /be
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to