Object.mixin/Object.assing with multiple args

Dmitry Soshnikov dmitry.soshnikov at gmail.com
Wed May 22 18:10:32 PDT 2013


Sorry, I didn't get it. Could you show an example of how it's potentially
can be used, I'm curious. If there is no practical need for this -- of
course it matters whether it worth or not.

Since the spec is not approve yet, and particularly that section on assign
and mixin, it's exactly now a good time to (re)consider it. Since if no
mixins will be available for class-syntax (as mentioned by Allen recently),
I at least want to see Object.mixin(...) accepting several arguments in
order to pass to a class' extends expression.

Dmitry


On Wed, May 22, 2013 at 6:05 PM, Rick Waldron <waldron.rick at gmail.com>wrote:

>
>
>
> On Wed, May 22, 2013 at 9:00 PM, Dmitry Soshnikov <
> dmitry.soshnikov at gmail.com> wrote:
>
>>
>> On Wed, May 22, 2013 at 5:53 PM, Rick Waldron <waldron.rick at gmail.com>wrote:
>>
>>>
>>>
>>>
>>> On Wed, May 22, 2013 at 7:48 PM, Dmitry Soshnikov <
>>> dmitry.soshnikov at gmail.com> wrote:
>>>
>>>> Hello,
>>>>
>>>> It's very likely it was (should have been I believe) discussed before,
>>>> and even probably was approved, but I don't see it in the latest draft yet.
>>>>
>>>
>>> The following has been discussed, but...
>>>
>>>
>>>>
>>>> Just to make sure, the signature of the "assign" and "mixin" method
>>>> should be:
>>>>
>>>> Object.assign(target, source,[source2, ..., sourceN]);
>>>> Object.mixin(target, source,[source2, ..., sourceN]);
>>>>
>>>> Current draft shows me only one source for both the methods.
>>>>
>>>
>>> That's correct. The third argument is being reserved for a descriptor
>>> map (potentially). Object.assign is not specified to match the _exact_
>>> behaviour of any existing object "merge", "extend", "mixin" operation.
>>>
>>>
>> OK, good to know. Can you show a practical example with this (potential)
>> descriptor map argument? Just wanna make sure it's really more useful than
>> accepting multiple sources.
>>
>>
>>> This is not unreasonable:
>>>
>>> function merge(target, ...sources) {
>>>   return sources.reduce(Object.assign, target);
>>> }
>>>
>>
>> Sure. The question is not that we can write own abstraction on top of
>> existing behavior, the question is having it out of the box. Unless the
>> descriptor map you mention really worth it.
>>
>
>
> Doesn't matter if you or I think the descriptor map is "really worth it",
> when I pushed for these, part of the consensus hinged on one target, one
> source.
>
> Rick
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130522/2c6df486/attachment.html>


More information about the es-discuss mailing list