Status: Assigned
Owner: [email protected]
CC: [email protected], [email protected], [email protected],
[email protected], [email protected]
Labels: Type-Bug Priority-Medium Harmony
New issue 4090 by [email protected]: TypedArray constructor doesn't
work on iterables
https://code.google.com/p/v8/issues/detail?id=4090
The ES6 spec requires that the %TypedArray% constructor calls the
equivalent of %TypedArray%.from. The definition there, in 22.2.2.1.1,
specifies that the semantics are:
- First, try to interpret the input through its [Symbol.iterator] property.
- If that doesn't exist, interpret it as an array-like object.
Even on arrays, a user can patch over Array.prototype[Symbol.iterator], so
this is readily observable. Even more straightforwardly, the %TypedArray%
constructor doesn't seem to support iterators at all, e.g., calling new
TypedArray(generator) doesn't work (creates an empty TypedArray).
d8> function* x() { for (var i = 0; i < 10; i++) yield i; }
undefined
d8> new Uint8Array(x()).length
0
d8> Array.from(x()).length
10
The Array.from behavior is right, and new %TypedArray%() is supposed to
behave broadly similarly.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.