> Le 7 oct. 2014 à 23:43, Dmitry Soshnikov <[email protected]> a écrit > : > >> On Tue, Oct 7, 2014 at 2:35 PM, Tab Atkins Jr. <[email protected]> wrote: >> On Tue, Oct 7, 2014 at 2:26 PM, Dmitry Soshnikov >> <[email protected]> wrote: >> > I see. Actually it doesn't work, your're correct, since >> > `Array.prototype.map` does preserve the kind (at least in the latest >> > draft). >> >> Hmm, per Rick's earlier email and >> <https://github.com/rwaldron/tc39-notes/blob/c61f48cea5f2339a1ec65ca89827c8cff170779b/es6/2013-01/jan-30.md#revising-the-array-subclassing-kind-issue>, >> Array#map (used by a subclass) doesn't preserve the subclass's type; >> it always returns an Array. >> >> > And the `UInt32Array.from(...)` would be consuming a nodeList, not an >> > array. >> > Will the `nodeList.map(node => parseInt(node.value, 10));` by itself >> > actually work then? >> >> If .map() is inherited from Array, and thus not type-preserving, yes, >> it'll work. > > Yes, it is preserving (probably was changed since that previous discussion), > see (9) in > http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.map. > Will a simple map to `node.value` on a `NodeList` work with the preserving > `Array#map`?
So, a `SortOfArray.from` (with a mapping) is finally less confusing than a `SortOfArray#map`, for you don't have to look at the doc in order to determine the type of the result... :-p —Claude
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

