Anonymous function syntax

Jonathan M Davis jmdavisProg at gmx.com
Thu Sep 22 15:06:37 PDT 2011


On Thursday, September 22, 2011 14:47 Andrei Alexandrescu wrote:
> On 9/22/11 4:13 PM, dsimcha wrote:
> > I'd much rather see the bugs in the current lambda syntax get fixed (e.g.
> > http://d.puremagic.com/issues/show_bug.cgi?id=4724) rather than spend
> > more time bikeshedding.
> 
> That's not an either-or choice, and of course improving current lambdas
> (btw that's not a purely syntactic bug) would improve the rewrites as well.
> 
> What I noticed lately is that people simply appreciate terse lambdas a
> whole lot. They hate C++ lambdas because you need to mention types,
> dislike Java's poor solution to lambdas to the extent the language had
> to add a feature just for them (which is subject to further controversy)
> and so on. I think current D is no slouch for lambda expressions, and
> function attribute deduction adds great power to lambdas, but further
> simplifying lambdas may mark a sensible improvement in their usability.

It wouldn't hurt my feelings any if an abbreviated lambda syntax weren't 
added, but it _is_ a bit annoying that lambdas are as long as they are for 
simple stuff - especially when I'm forced to use the lambda syntax because the 
string syntax that I was trying to use wouldn't work for one reason or 
another. So, adding an abbreviated lambda syntax is likely a good idea. And 
your suggested syntax is probably the right way to go, since it's most similar 
to C# rather than one of the functional languages, and none of the other 
syntaxes are really objectively better anyway. But we will need someone to 
take the time to implement it (though fortunately, that's far easier now than 
it used to be given the increasing number of contributors to dmd).

- Jonathan M Davis


More information about the Digitalmars-d mailing list