I forgot to mention that the call to () do {...} should work as written
in 11.1.7 in block_lambda_revival (if not my second example does not
work), so the behavior is supposed to be the same (if
[[FormalParameters]] is empty), I was more focused on the "this" stuff
(do examples 1 and 3 look useless ?).
I did not say that block lambdas were not interesting and powerfull, I
just think that this might be difficult to swallow/use by developpers,
so an intermediate approach maybe was not bad, but apparently it is no
possible.
Le 08/03/2012 19:22, Brendan Eich a écrit :
Aymeric Vitte wrote:
Indeed it looks more intuitive than block lambdas (IMHO).
Intuitions vary, but why does
function huh(a, b) {
let toss = () do{return a*b};
downward(toss);
return 42;
}
where downward, if it calls its argument, forces a return of a*b from
huh, and control never reaches the return 42, seem "intuitive" to you?
Does the () do ... syntax by itself convey a "Tennent sequel"?
Block-lambdas have precedent, intuitive or not, going back to
Smalltalk via Ruby, of behaving in this different and (to some)
surprising way. They look odd enough to better call attention to the
novelty, in my opinion, than a mix of () and do.
function huh(a, b) {
let lambda = {|| return a*b};
downward(toss);
return 42;
}
Anyway, the current proposal has grammatical issues already plaguing
arrow function syntax. Block-lambdas have no such problems. But this
is not a contest: we could have shorter function syntax (e.g., 'fn' if
not some prefix-less proposal that solves the grammar problems). And
we could have block-lambdas on top.
What we won't have is full TCP in a function-body-plan. Sufficiently
distinct semantics need markedly different syntax. Is '()do'
freaky-deaky enough? I don't think so, right now.
/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss