Generator getter method

Bergi a.d.bergi at
Tue Nov 10 23:32:25 UTC 2015

Mohsen Azimi schrieb:

> I'm proposing to allow  `get corners* () { ...` (a generator getter
> method) so the for..of loop can be written like this:
> ```
> for (let corner of rectangle.corners) {
>    console.log(corner);
> }
> ```

I would avoid that. `rectangle.corners !== rectangle.corners` could be 
quite confusing. Creating the generator explicitly is a better idea.
And as kevin said, you still can return generators from your getters 
manually if you really want that.


More information about the es-discuss mailing list