Future of string lambda functions/string predicate functions
Dmitry Olshansky
dmitry.olsh at gmail.com
Wed Aug 14 10:15:33 PDT 2013
14-Aug-2013 20:37, H. S. Teoh пишет:
> On Wed, Aug 14, 2013 at 09:26:20AM -0700, Andrei Alexandrescu wrote:
[snip]
> It just occurred to me, that perhaps what we really need here is an
> even more abbreviated form of lambda literals, like this:
>
> sort!(a < b)(range);
>
> where 'a' and 'b' are undefined identifiers in the current scope, and
> the compiler would know to bind them to lambda parameters. Defined
> identifiers would, naturally, bind to whatever they refer to:
>
Make that
sort!( _ < _)(range)
and you have some Scala :)
> int x = 5;
> find!(a == x)(range);
>
> This would be equivalent to:
>
> int x = 5;
> find!((a) => a==x)(range);
>
> IOW, an expression that references undefined identifiers in a template
> parameter would be turned into a lambda that parametrize said
> identifiers.
>
>
> T
>
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list