A Matías Quezada (2013-12-18T09:23:21.000Z)
I can't see a better use for extra arguments than multiple extensions. This
is how current libraries implement it and we expect to replace it with
Object.assign. In case Object.assign accepts only two arguments I think
this snippet will be everywhere

    Object.assign(Object.assign({}, defaultParams), userParams);
    // or
    [ {}, defaultParams, userParams ].reduce(Object.assign);

I think using properties descriptor at Object.assign will be a mix of
concepts, and a pattern I see a lot less than _.extend, and we'll be able
to do it anyway

    Object.defineProperties(Object.assign({}, properties), descriptors);
    // or
    Object.assign(Object.create(something, descriptors), properties);

And deep copy doesn't look like an option for me, as Brendan said it adds
so much complexity for an edge case.

I think accepting several source objects like _.extend, $.extend and
angular.extend would be the more practical option.


---
A. Matías Quezada
Senior Javascript Developer
amatiasq at gmail.com



2013/12/18 Andrea Giammarchi <andrea.giammarchi at gmail.com>

> Rick I tend to aree with you if not that the second argument of
> Object.create has basically reached zero libraries and popularity out there
> due un-shimmable and "boring to write" common/usual properties.
>
> In this very specific case it would be inconsistent with the previous
> argument too since that won't be checked through getOwnPropertyNames in any
> case ... you know what I mean?
>
> Cheers
>
>
> On Tue, Dec 17, 2013 at 7:06 PM, Rick Waldron <waldron.rick at gmail.com>wrote:
>
>>
>>
>>
>> On Tue, Dec 17, 2013 at 8:17 PM, Brendan Eich <brendan at mozilla.com>wrote:
>>
>>> It's now or never. I agree multiple sources are useful enough to do now;
>>> I don't see a different third parameter that would be precluded by deciding
>>> this. But others may disagree.
>>>
>>
>> A third Properties argument that matches the second Properties argument
>> to Object.create() and Object.defineProperties
>>
>> class Cycle {
>>   constructor(details) {
>>     Object.assign(this, details, {
>>       wheels: {
>>         value: details.type === "tricycle" ? 3 : 2,
>>         configurable: false,
>>         writable: false
>>       }
>>     });
>>   }
>> }
>>
>> var trike = new Cycle({
>>   color: "red",
>>   type: "tricycle"
>> });
>>
>> ... Which doesn't break the reduce pattern since the index would
>> effectively be meaningless in that context, ie.
>> Object.getOwnPropertyNames(Object(1)).length === 0;
>>
>> Anyway...I had originally pushed for Object.assign with multiple sources
>> and dropped it when consensus seemed to hinge on "one target, one source".
>> The third Properties argument is compelling and doesn't prevent using
>> Object.assign as a primitive mechanism for library code to build on top of.
>>
>> Rick
>>
>>
>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131218/cc3bb413/attachment.html>
domenic at domenicdenicola.com (2014-01-03T16:22:09.301Z)
I can't see a better use for extra arguments than multiple extensions. This
is how current libraries implement it and we expect to replace it with
`Object.assign`. In case `Object.assign` accepts only two arguments I think
this snippet will be everywhere

```js
Object.assign(Object.assign({}, defaultParams), userParams);
// or
[ {}, defaultParams, userParams ].reduce(Object.assign);
```

I think using properties descriptor at `Object.assign` will be a mix of
concepts, and a pattern I see a lot less than `_.extend`, and we'll be able
to do it anyway

```js
Object.defineProperties(Object.assign({}, properties), descriptors);
// or
Object.assign(Object.create(something, descriptors), properties);
```

And deep copy doesn't look like an option for me, as Brendan said it adds
so much complexity for an edge case.

I think accepting several source objects like `_.extend`, `$.extend` and
`angular.extend` would be the more practical option.
domenic at domenicdenicola.com (2014-01-03T16:21:26.201Z)
I can't see a better use for extra arguments than multiple extensions. This
is how current libraries implement it and we expect to replace it with
`Object.assign`. In case `Object.assig`n accepts only two arguments I think
this snippet will be everywhere

```js
Object.assign(Object.assign({}, defaultParams), userParams);
// or
[ {}, defaultParams, userParams ].reduce(Object.assign);
```

I think using properties descriptor at Object.assign will be a mix of
concepts, and a pattern I see a lot less than _.extend, and we'll be able
to do it anyway

```js
Object.defineProperties(Object.assign({}, properties), descriptors);
// or
Object.assign(Object.create(something, descriptors), properties);
```

And deep copy doesn't look like an option for me, as Brendan said it adds
so much complexity for an edge case.

I think accepting several source objects like `_.extend`, `$.extend` and
`angular.extend` would be the more practical option.