On Thu, Jan 18, 2018 at 12:37 PM, T.J. Crowder <
[email protected]> wrote:

> On Thu, Jan 18, 2018 at 5:28 PM, 森建 <[email protected]> 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
    obj.set.bind(obj)
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.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to