On Oct 26, 2013, at 4:59 PM, Lucio Tato <[email protected]> wrote:

> Rick: I understand. But it is always a trade-off.
> 
> If the reason to introduce a new construct is because there may already be 
> code that defines a function called `yield`, it seems to me as a bad 
> trade-off. (advantages vs disadvantages)
> 
> In your example... 
> function yield() {... <- will raise a parsing error.
> 

You can’t make yield a reserved word — which is what you’re asking for here.  
This isn’t a matter of whether or not you use generators, it’s a matter of 
whether other code in the same environment ever uses a property named yield.  
All of the options necessarily require breaking yield in existing code


> Anyway, there are other ways to solve that.
> You can put the asterisk in "yield" instead of the important "function". It's 
> a lot less confusing.
> 
> function fibonacci() {
>     let [prev, curr] = [0, 1];
>     for (;;) {
>         [prev, curr] = [curr, prev + curr];
>         yield*(curr);

This already parses a (yield)*(curr)

Please stop trying to get rid of the *, there isn’t any other viable option, 
and this has been covered ad nauseum on es-discuss

—Oliver
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to