> Le 19 juil. 2018 à 13:56, Andrea Giammarchi <[email protected]> a 
> écrit :
> 
> 
> Compared to every other public static method in ECMAScript that works, 
> including those methods that might need the contextual class, as it is for 
> the Array.from case.
> 
> ```js
> const {from} = Array;
> 
> from({0: 'abc', length: 1}); // ["abc"] // all good
> ```

That pattern falls apart when subclassing:

```js
class ImprovedArray extends Array {
        /* implementation NOT overriding the `from` static method  */
}

const {from} = ImprovedArray

from({0: 'abc', length: 1}) // Array instance instead of ImprovedArray instance
```

So, no, the `Array.from` precedent is a bad one.

—Claude

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to