mikesamuel at gmail.com
Thu Jan 18 18:08:55 UTC 2018
On Thu, Jan 18, 2018 at 12:37 PM, T.J. Crowder <
tj.crowder at farsightsoftware.com> wrote:
> On Thu, Jan 18, 2018 at 5:28 PM, 森建 <moriken at kimamass.com> wrote:
> > This code is redundant. I just want to write
> > `mapA.assign(mapB, mapC);`.
> FWIW, it would be more in keeping with `Object.assign` if it were on `Map`
> rather than `Map.prototype`. E.g., you'd write the code above like this:
What if, instead of a variety of assign methods, we respeced
Object.assign to do this given a Map as the left-value?
If Object.assign sees a "set" method of length 2, then it stores
and uses that rather than assigns to fields.
Two points of potential controversy:
- if an array is on the right, do we pass string or integer keys
to the bound setter?
- if we allow Maps on the right, we could allow WeakMaps
on the left. Users might assume that WeakMap could then
be used on the right.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss