The Strange Loop conference

Jacob Carlborg doob at me.com
Fri Sep 23 13:07:19 PDT 2011


On 2011-09-23 18:05, Simen Kjaeraas wrote:
> 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);

The important thing here was the lambda syntax, not if it's passed as a 
template parameter or a regular parameter.


-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list