March 28 meeting notes

Andreas Rossberg rossberg at google.com
Thu Mar 29 13:57:39 PDT 2012


On 29 March 2012 22:26, Brendan Eich <brendan at mozilla.org> wrote:

> Andreas Rossberg wrote:
>
>> For me, the biggest blow against TCP lambda forms in general was Mark's
>> observation regarding the incompatibility with 'yield' that you mention in
>> the other post.
>>
>
> It seems 'yield' may be a red herring. We all forgot that it is
> contextually defined as a keyword only in generator functions, which have a
> distinguished head (* after function or before method name).
>

Well, in the same way 'return' is contextually defined as a keyword in
ordinary functions. ;)

Arrows cannot be generator functions, so yield is not reserved in arrow
> bodies.


Wait, that isn't the issue. The issue is that if 'yield' does not work,
then control-flow abstractions (which are the main motivation for TCP
lambdas) won't generally work, because they could not be used in
generators. Just to give a stupid example, consider:

function* squares(a) {
  for (int i = 0; i < a.length; ++i)
    yield a[i]*a[i];
}

This cannot be turned into:

function* squares(a) {
  a.forEach(x => yield x*x);
}

To me, that seems like a complete roadblock wrt the primary motivation for
TCP lambdas.

/Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120329/4252c455/attachment.html>


More information about the es-discuss mailing list