Tab Atkins Jr. (2015-04-15T16:31:40.000Z)
On Wed, Apr 15, 2015 at 9:23 AM, monolithed <monolithed at gmail.com> wrote:
> ```js
> let x = [0, 1, 2];
> let y = [3, 4, 5];
>
>
> // Expected
> [ for (i of [x, y]) ...i ];
>
>
> // Reality
> Array.prototype.concat(...[ for (x of [x, y]) i ]);
>
>
> // Result
> [0, 1, 2, 3, 4, 5]
> ```
>
> Is there any discussion on this subject?

+1. Right now you can insert 1 (default) or 0 (with a filter) elements
per iteration, but you can't insert 2+.  This lack in Python has
forced me to unwrap several comprehensions into explicit loops, which
is annoying.

The general solution to this is monadic, which has been inconclusively
discussed in the past, but the use of the spread operator for this
case is very compelling, imo.  It feels *natural*.

~TJ
d at domenic.me (2015-04-19T23:52:10.339Z)
On Wed, Apr 15, 2015 at 9:23 AM, monolithed <monolithed at gmail.com> wrote:

> Is there any discussion on this subject?

+1. Right now you can insert 1 (default) or 0 (with a filter) elements
per iteration, but you can't insert 2+.  This lack in Python has
forced me to unwrap several comprehensions into explicit loops, which
is annoying.

The general solution to this is monadic, which has been inconclusively
discussed in the past, but the use of the spread operator for this
case is very compelling, imo.  It feels *natural*.