Block lambda is cool, its syntax isn't

Thaddee Tyl thaddee.tyl at gmail.com
Wed Jan 18 01:59:34 PST 2012


On Wed, Jan 18, 2012 at 10:28 AM, Gavin Barraclough
<barraclough at apple.com>wrote:

> Just a thought, has a prefix ^ been considered?
>
> A lambda that takes no arguments could be:
> ^{ /*...*/ }
> And a lambda with some arguments:
> ^(x,y){ /*...*/ }
>
> I just find this really readable, the syntax for lambdas that take no
> arguments is delightfully minimal (just one extra character!), my brain is
> well trained to expect argument lists to be delimited by parentheses so I
> find this much easier to understand, and I find the ^ character pleasingly
> evocative of λ. :-)
>

This is really a matter of taste.

    { (a, b) ... }

    ^(a, b) { ... }

    { |a, b| ... }

Of course, some characters are easier to type than others, especially in
non-qwerty keyboards (I'm thinking about the pipe "|").

But what matters most is readability, since code is more often read than
written. So far, people seem to think that pipes are more readable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120118/8b1496d8/attachment-0001.html>


More information about the es-discuss mailing list