According to the January 30 meeting notes, Array.from is getting
optional map functionality.[1]
This is motivated by the following example:
class V extends Array {
constructor(...args) {
super(...args);
}
}
var v, m;
v = new V(1, 2, 3);
m =
According to [1], Array.from will first try treating the argument as
an iterable, then as an arraylike. This is much better than just
arraylike. The committee considered making it iterable only, but
decided against it. The rationale recorded in the notes is:
RW: No.
Rick, can you expand on
I'm with Jason here.
The only argument I can vaguely remember is that people want to be
able to use these on old browsers without @@iterator? But I don't see
why a polyfill could not tag things with __iterator__ or something
else?
On Mon, Jun 24, 2013 at 11:54 AM, Jason Orendorff
On Jun 24, 2013, at 8:42 AM, Jason Orendorff wrote:
According to the January 30 meeting notes, Array.from is getting
optional map functionality.[1]
This is motivated by the following example:
class V extends Array {
constructor(...args) {
super(...args);
}
For reference, this is the thread:
https://mail.mozilla.org/pipermail/es-discuss/2013-February/028661.html
On 6/24/2013 9:31 AM, Allen Wirfs-Brock wrote:
On Jun 24, 2013, at 8:42 AM, Jason Orendorff wrote:
According to the January 30 meeting notes, Array.from is getting
optional map
On Jun 24, 2013, at 9:07 AM, Erik Arvidsson wrote:
I'm with Jason here.
The only argument I can vaguely remember is that people want to be
able to use these on old browsers without @@iterator? But I don't see
why a polyfill could not tag things with __iterator__ or something
else?
I
From: Allen Wirfs-Brock [al...@wirfs-brock.com]
My recollection is that we first discussed that the existence of Array.from
make this issue somewhat less important because, just as you point out, .from
can be used in conjunction with anything that produces an Iterable such as
On Mon, Jun 24, 2013 at 11:54 AM, Jason Orendorff jason.orendo...@gmail.com
wrote:
According to [1], Array.from will first try treating the argument as
an iterable, then as an arraylike. This is much better than just
arraylike. The committee considered making it iterable only, but
decided
On 6/24/2013 9:42 AM, Domenic Denicola wrote:
That led to further discision of that usage and we got into things like the
last example:
```js
// Turn an array of nodeNames into NodeList of nodes
NodeList.from( [div], node = document.createElement(node) );
```
I think I must be missing
On 6/24/2013 9:44 AM, Brandon Benvie wrote:
On 6/24/2013 9:42 AM, Domenic Denicola wrote:
That led to further discision of that usage and we got into things
like the last example:
```js
// Turn an array of nodeNames into NodeList of nodes
NodeList.from( [div], node =
On Jun 24, 2013, at 9:42 AM, Domenic Denicola wrote:
From: Allen Wirfs-Brock [al...@wirfs-brock.com]
My recollection is that we first discussed that the existence of Array.from
make this issue somewhat less important because, just as you point out,
.from can be used in conjunction with
From: Rick Waldron [waldron.r...@gmail.com]
One reason is the extra allocation...
It's not at all arbitrary: filter isn't an operation used to change the value
of the items in the returned iterable.
OK, I think I see. This is because `NodeList.prototype.map` behaves differently
from
On Jun 24, 2013, at 10:22 AM, Domenic Denicola wrote:
From: Rick Waldron [waldron.r...@gmail.com]
One reason is the extra allocation...
It's not at all arbitrary: filter isn't an operation used to change the
value of the items in the returned iterable.
OK, I think I see. This is
Thanks Allen. The
```js
var squaredSmalls_try2= Int16Array.from(smalls.map(v= v*v)); // still no
good, because intermediate array is Int8Array
```
example certainly clears it up for me. Tricky stuff.
I was going to write it's still a bit weird to me that we overload
`Array.from` with
On Mon, Jun 24, 2013 at 12:55 PM, Domenic Denicola
dome...@domenicdenicola.com wrote:
Thanks Allen. The
```js
var squaredSmalls_try2= Int16Array.from(smalls.map(v= v*v)); // still no
good, because intermediate array is Int8Array
```
example certainly clears it up for me. Tricky stuff.
Sorry for bringing this point up, again. It is a minor point, but details
matter if ECMAScript 6 is supposed to feel consistent.
In general, I like how ECMAScript 6 has evolved functions. Before, functions
played three roles:
1. Constructor
2. Method
3. Non-method function (where you want
On Mon, Jun 24, 2013 at 9:31 AM, Allen Wirfs-Brock al...@wirfs-brock.comwrote:
On Jun 24, 2013, at 8:42 AM, Jason Orendorff wrote:
According to the January 30 meeting notes, Array.from is getting
optional map functionality.[1]
This is motivated by the following example:
class V
On Mon, Jun 24, 2013 at 5:00 PM, Mark S. Miller erig...@google.com wrote:
On Mon, Jun 24, 2013 at 4:46 PM, Axel Rauschmayer a...@rauschma.dewrote:
Sorry for bringing this point up, again. It is a minor point, but details
matter if ECMAScript 6 is supposed to feel consistent.
In general, I
On Jun 24, 2013, at 5:21 PM, Dmitry Soshnikov wrote:
On Mon, Jun 24, 2013 at 9:31 AM, Allen Wirfs-Brock al...@wirfs-brock.com
wrote:
On Jun 24, 2013, at 8:42 AM, Jason Orendorff wrote:
According to the January 30 meeting notes, Array.from is getting
optional map functionality.[1]
On Mon, Jun 24, 2013 at 5:45 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote:
On Jun 24, 2013, at 5:21 PM, Dmitry Soshnikov wrote:
On Mon, Jun 24, 2013 at 9:31 AM, Allen Wirfs-Brock
al...@wirfs-brock.comwrote:
On Jun 24, 2013, at 8:42 AM, Jason Orendorff wrote:
According to the
20 matches
Mail list logo