Brendan Eich (2013-09-06T15:39:20.000Z)
Brandon Benvie wrote:
> I don't think you're missing anything. They seem to be more accurately 
> described as Iterator Expressions than Generator Expressions. It might 
> be interesting if you could use yield inside them, which would then 
> make sending a value in useful. But without that they don't expose any 
> generator interface externally. 

They could be called something else, for sure. The name works because 
they're sugar for a generator function immeidately invoked:

(for (x of [1,2, 3])  x * x)

is

(function*() { for (let x of [1,2, 3])  yield x * x; })()


The name also may have Python roots that predate Python 2.5's more complete (send as well as next; throw; close) generator interface.

I think we should keep the name, because it's more precise. Iterator expression could be taken to mean other things a bit too easily.

/be
domenic at domenicdenicola.com (2013-09-17T19:57:10.433Z)
Brandon Benvie wrote:
> I don't think you're missing anything. They seem to be more accurately 
> described as Iterator Expressions than Generator Expressions. It might 
> be interesting if you could use yield inside them, which would then 
> make sending a value in useful. But without that they don't expose any 
> generator interface externally. 

They could be called something else, for sure. The name works because 
they're sugar for a generator function immeidately invoked:

```js
(for (x of [1,2, 3])  x * x)
```

is

```js
(function*() { for (let x of [1,2, 3])  yield x * x; })()
```

The name also may have Python roots that predate Python 2.5's more complete (send as well as next; throw; close) generator interface.

I think we should keep the name, because it's more precise. Iterator expression could be taken to mean other things a bit too easily.