Future of string lambda functions/string predicate functions

w0rp devw0rp at gmail.com
Wed Aug 14 12:24:38 PDT 2013


On Wednesday, 14 August 2013 at 18:18:32 UTC, Dmitry Olshansky 
wrote:
> In D:
> alias f = _ + _;

In addition to being a D fan, I am also a Scala fan, and I use 
the magic underscore syntax in Scala now and again. While it can 
sometimes be useful, I don't feel like it absolutely needs to 
exist in the language.

I would like to argue in favour of gradually replacing the string 
lambdas which just lambdas. I don't personally see a huge problem 
in typing (x, y) => x < y. It very clearly expresses your intent, 
and this is very brief syntax. The underscore syntax only takes 
away from the expressiveness to reduce line length.

As mentioned before, for very common lambdas that you don't want 
to type yourself, you could define those functions as generic 
functions with a given name, like a 'less' function.


More information about the Digitalmars-d mailing list