Future of string lambda functions/string predicate functions

Jonathan M Davis jmdavisProg at gmx.com
Tue Aug 6 02:25:59 PDT 2013


On Tuesday, August 06, 2013 11:05:56 Jakob Ovrum wrote:
> What does everyone think?

I'm completely opposed to the removal of string lambdas. Obviously, they don't 
always work. More complicated functions definitely need to use the newer lambda 
syntax or function literals. But for simple lambdas, they're way better. I'd 
_much_ rather have func!"a != b"(args) than func!((a, b) => a != b)(args) or 
func!"a < b"(args) than func!((a, b) => a < b)(args). String lambdas are nice 
and short, and I think that they're plenty clear, and if they're not, they're 
trivial to explain.

We already have string lambdas. Removing them would break code for little 
benefit IMHO. If you prefer to use the newer lambda syntax, then use that, but 
I think that it's a definite loss if we get rid of the string lambdas, as 
they're so much more concise when they do work.

I also think that all new Phobos functions which take unary or binary 
predicates should support string lambdas. It's trivial for them to do so, and 
it creates needless inconsistencies if some functions support them and some 
don't.

- Jonathan M Davis


More information about the Digitalmars-d mailing list