Re: Precedence of yield operator

2013-06-16 Thread Bruno Jouhier
Hi Mark, Thanks a lot for the pointers and for taking the time to debrief me on the proposal. I had stumbled on the concurrency paper a while ago but never took the time to read it thoroughly. I surely will! It is good to see that the problem is being attacked from a generic angle with an eye on

Re: Precedence of yield operator

2013-06-16 Thread Bruno Jouhier
ery similar to a function call to me. If we do this, the predecence >>> becomes intuitive again: >>> >>>var x = yield(a) + yield(b); >>>yield(a+b); >>> >>> I think there was a proposal to allow parenthesis-free function call at >&g

Re: Precedence of yield operator

2013-06-15 Thread Oliver Hunt
"yield" as a function. Indeed, > it calls another code, which can return you a value. That looks very similar > to a function call to me. If we do this, the predecence becomes intuitive > again: > >var x = yield(a) + yield(b); > yield(a+b); > > I t

Re: Precedence of yield operator

2013-06-15 Thread Rick Waldron
a normal statement again. In the mean time we can just use parentheses, > that's not a huge issue and it helps clarity. > > > > But maybe this is too late to change ES6, it's just an idea I had while > reading this thread, not a strong call for change. > > > &g

Re: Precedence of yield operator

2013-06-15 Thread François REMY
There is an issue when the argument of an intended parenthesis-free function call happens to begin with a parenthesis. Just like there are issues if you want to return an object literal from a lambda in JS, you've to use parentheses around it. Not a big deal. Anyway, I'm not saying we should

Re: Precedence of yield operator

2013-06-15 Thread Claude Pache
Le 15 juin 2013 à 10:18, François REMY a écrit : > I'm maybe biased, but I would love to consider "yield" as a function. Indeed, > it calls another code, which can return you a value. That looks very similar > to a function call to me. If we do this, the predecence becomes intuitive > again:

Re: Precedence of yield operator

2013-06-15 Thread Bruno Jouhier
o change ES6, it's just an idea I had while > reading this thread, not a strong call for change. > > > > > > > -Message d'origine- From: Brendan Eich > Sent: Saturday, June 15, 2013 6:17 AM > To: Dean Tribble > Cc: Bruno Jouhier ; es-discuss@mozilla.org > Subject:

Re: Precedence of yield operator

2013-06-15 Thread François REMY
convresation and got a nice summary, pasted here: -- Forwarded message -- From: *Mads Torgersen* <mailto:mads.torger...@microsoft.com>> Date: Fri, Jun 14, 2013 at 2:11 PM Subject: RE: Precedence of yield operator To: Dean Tribble mailto:trib...@e-dean.com>> I’m n

Re: Precedence of yield operator

2013-06-14 Thread Brendan Eich
: -- Forwarded message -- From: *Mads Torgersen* <mailto:mads.torger...@microsoft.com>> Date: Fri, Jun 14, 2013 at 2:11 PM Subject: RE: Precedence of yield operator To: Dean Tribble mailto:trib...@e-dean.com>> I’m not on the mailing list. Feel free to forward to it.

Fwd: Precedence of yield operator

2013-06-14 Thread Bruno Jouhier
> I don’t know if a similar thing is possible in EcmaScript. But I believe > that a low-precedence yield as a substitute for a high-precedence await is > problematic: you never want “yield a + yield b” to mean “yield (a + (yield > b))”: the things you await – Task, Promises, Futures, whatever you c

Re: Precedence of yield operator

2013-06-14 Thread Dean Tribble
This is a familiar discussion from C#. I forwarded it to the mediator of that convresation and got a nice summary, pasted here: -- Forwarded message -- From: Mads Torgersen Date: Fri, Jun 14, 2013 at 2:11 PM Subject: RE: Precedence of yield operator To: Dean Tribble I’m not on

Re: Precedence of yield operator

2013-06-14 Thread Bruno Jouhier
The current precedence looks natural to me for a yield but less when yield is used as an await keyword. That's why I proposed to handle it with a different keyword rather than by changing yield's precedence. Await would have been a good candidate but it is not reserved. Anyway, I don't want to ma

Re: Precedence of yield operator

2013-06-14 Thread Brendan Eich
Bruno Jouhier wrote: While playing with my little async/await library, I noticed that I was often forced to parenthesize yield expressions as (yield exp) because of the low precedence of the yield operator. Typical patterns are: var foo = (yield a()) + (yield b()) + (yield c()); That's actua

Re: Precedence of yield operator

2013-06-14 Thread Tab Atkins Jr.
On Fri, Jun 14, 2013 at 5:33 PM, Sam Tobin-Hochstadt wrote: > On Fri, Jun 14, 2013 at 11:21 AM, Tab Atkins Jr. wrote: >> Using generators for async is a clever hack, but it's just a hack. A >> proper solution will need a new keyword anyway (most languages seem to >> use "await" or something simi

Re: Precedence of yield operator

2013-06-14 Thread Sam Tobin-Hochstadt
On Fri, Jun 14, 2013 at 11:21 AM, Tab Atkins Jr. wrote: > Using generators for async is a clever hack, but it's just a hack. A > proper solution will need a new keyword anyway (most languages seem to > use "await" or something similar), which can get the better > precedence. This is just not tru

Re: Precedence of yield operator

2013-06-14 Thread Tab Atkins Jr.
On Fri, Jun 14, 2013 at 5:12 PM, Bruno Jouhier wrote: > While playing with my little async/await library, I noticed that I was often > forced to parenthesize yield expressions as (yield exp) because of the low > precedence of the yield operator. Typical patterns are: > > var foo = (yield a()) + (y

Precedence of yield operator

2013-06-14 Thread Bruno Jouhier
While playing with my little async/await library, I noticed that I was often forced to parenthesize yield expressions as (yield exp) because of the low precedence of the yield operator. Typical patterns are: var foo = (yield a()) + (yield b()) + (yield c()); if ((yield a()) && cond2 ...) ... Look