The Strange Loop conference

Simen Kjaeraas simen.kjaras at gmail.com
Fri Sep 23 09:05:24 PDT 2011


On Thu, 22 Sep 2011 11:22:10 +0200, Jacob Carlborg <doob at me.com> wrote:

>> auto newrange = filter!"a<5"(map!"2*a"(range));
>>
>> At first some people get the heebiejeebies when seeing string-based
>> lambda and the implicit naming convention for unary and binary
>> functions. More importantly, there's the disadvantage you can't access
>> local functions inside a string lambda. We should probably add a
>> specialized lambda syntax.
>
> I like this syntax:
>
> auto newRange = range.map(a => 2 * a).filter(a => a < 5);

I dislike this syntax, in that it seems to pass the delegates as normal
function parameters, rather than template parameters.
New version:

auto newRange = range.map!(a => 2 * a).filter!(a => a < 5);

-- 
   Simen


More information about the Digitalmars-d mailing list