even more delegate sugar
Tom S
h3r3tic at remove.mat.uni.torun.pl
Mon Aug 21 16:53:59 PDT 2006
While we're at it, how about allowing the construct:
methodName (arg, arg, ..., arg, { ... });
to be equivalent to:
methodName (arg, arg, ..., arg) { ... }
and
methodName ({ ... });
to
methodName {}
Then e.g. the 'dotimes' example from 'Lazy Evaluation of Function
Arguments' would become:
void foo() {
int x = 0;
dotimes(10) {
writef(x++);
}
}
Which eliminates the need for lazy evaluation in this case, as it simply
uses a delegate. Moreover, it is more readable and concise at the same time.
--
Tomasz Stachowiak
More information about the Digitalmars-d
mailing list