But... I don't want my delegates to be lazy - breeding advice
Sean Kelly
sean at f4.ca
Thu Aug 24 07:49:33 PDT 2006
Walter Bright wrote:
> Ok, I've thought about it a bit:
>
> void foo(int x); // same as before 0.165
> void foo(int delegate() x) // same as before 0.165
>
> and now:
>
> void foo(lazy int x);
>
> In other words, 'lazy' is now a parameter storage class. This means that:
>
> void foo(int x);
> void foo(lazy int x);
>
> cannot be distinguished based on overloading, but:
>
> void foo(lazy int x);
> void foo(int delegate() x);
>
> can be. The implicit conversion of a value to a delegate returning that
> value would be removed. The conversion happens always (not implicitly)
> if the parameter storage class is 'lazy'.
Fantastic! This will even allow lazy values to be pre-constructed,
which is a nice perk.
Sean
More information about the Digitalmars-d
mailing list