Why Ruby?
Simen kjaeraas
simen.kjaras at gmail.com
Tue Dec 14 10:49:37 PST 2010
Stephan Soller <stephan.soller at helionweb.de> wrote:
> [1, 2, 3, 4, 5].select((int e){ return e > 3; })
> .collect((int e){ return e*e; });
>
> It's already fairly compact. The main overhead is the parameter type and
> the return statement. I don't believe this can be reduced any more
> without breaking consistency of the language.
The delegates can be passed by alias parameter, and then be written
without the parameter type:
@property void bar(alias t)() {
t(3);
}
void main() {
bar!((e){writeln(e);});
}
--
Simen
More information about the Digitalmars-d
mailing list