Anonymous function syntax

Jonathan M Davis jmdavisProg at gmx.com
Fri Sep 23 21:51:45 PDT 2011


On Friday, September 23, 2011 23:42:52 Andrei Alexandrescu wrote:
> On 9/23/11 8:03 PM, Martin Nowak wrote:
> > On Thu, 22 Sep 2011 22:54:55 +0200, Andrei Alexandrescu
> > <SeeWebsiteForEmail at erdani.org> wrote:
> > I want to add some points against introducing this particular syntax.
> > 
> > 1. Foremost using '=>' is unfamiliar. Comming from C++ or Java you
> > really have to learn reading it.
> > If you weighted the lambda syntaxes with the tiobe factor, arrows would
> > be a minority.
> 
> Well the C++2011 lambda syntax is quite foreign for C++ users, too.

And Andrei's suggested syntax is very similar to C#'s lambda syntax, so it 
_is_ a syntax familiar to some of the programmers who use a major language 
derived from C++. It's certainly going to be more familiar than the syntax of 
any of the functional languages out there.

My personal take on it is that if we want more compact lambdas, Andrei's 
proposal gets them about as compact as they can be, and it's similar to C# 
rather than one of the functional languages, so it's more likely to be 
familiar to more D programmers (based on the assumption that D programmers are 
more likely to have programmed in C# than any of the functional languages, or 
at least that D programmers are more likely to be intimately familiar with C# 
than any of the functional languages). So, it's probably the best that we're 
going to get for a compact lambda syntax. The only question is whether we 
really want to add a more compact lambda syntax, and I think that there's 
enough desire for it that we do.

- Jonathan M Davis


More information about the Digitalmars-d mailing list