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

Reply via email to