Possible enhancement: Concise return statements

David Nadlinger see at klickverbot.at
Mon Aug 15 11:01:48 PDT 2011


On 8/15/11 7:53 PM, bearophile wrote:
> Timon Gehr:
>> map!((a){a*foo(a)})(arr);
>
> You have picked a suboptimal example, because D/Phobos already allows you write this (because the delegate uses only global names beside its arguments):
>
> map!q{ a * foo(a) }(arr);

No! As long as foo() is not in the »blessed« set of modules imported by 
std.functional, there is no way to access it from a string literal lambda.

David


More information about the Digitalmars-d mailing list