A nice way to step into 2012

Timon Gehr timon.gehr at gmx.ch
Wed Dec 28 09:54:50 PST 2011


On 12/28/2011 05:59 PM, Jacob Carlborg wrote:
> On 2011-12-28 13:54, bearophile wrote:
>> Timon Gehr:
>>
>>> => expr
>>>
>>> should imo be a shorthand for
>>>
>>> () => expr.
>>>
>>> It saves some ((())(()))().
>>
>> It saves few (), but zero argument lambdas aren't that common in my
>> functional-style code, and I think it decreases syntax uniformity and
>> code readability. So I think it's a bad idea.
>
> It can already be done with the lazy arguments.
>
> void foo (lazy int a)
> {
> auto b = a();
> }
>
> int bar ();
> foo(bar());
>

It is not the same thing. lazy arguments do not create a closure.


More information about the Digitalmars-d mailing list