String lambdas

Mint via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 30 08:10:08 PDT 2016


On Tuesday, 26 April 2016 at 19:45:18 UTC, Jack Stouffer wrote:
> I'm of the opinion that string lambdas must go. I started, and 
> I really should finish it at some point, removing string 
> lambdas from the documentation: 
> https://github.com/dlang/phobos/pull/3800
>
> I think that the drawback you mentioned does not outweigh the 
> benefits gained from using actual lambdas.

I'm personally somewhat fond of string lambdas for their 
usefulness in making some operations very concise, without 
sacrificing any readability.

ie.

   foo.map!"a.bar".reduce!"a * b";

vs.

   foo.map!(a => a.bar).reduce!((a, b) => a * b);

I'm open to an alternative that is equally short and sweet, but 
replacing them with proper lambda declarations feels like 
uncalled for verbosity to me.


More information about the Digitalmars-d mailing list