Custom Blocks
aarti_pl
aarti at interia.pl
Tue Aug 10 07:42:36 PDT 2010
W dniu 2010-08-10 05:21, Andrei Alexandrescu pisze:
> Chris Williams wrote:
>> I'm not sure whether the design of D 2.0 has stabilized as yet, but if
>> not,
>> I would like to suggest the ability to create custom block types.
> [snip]
>
> FWIW we've been talking a long time ago about a simple lowering - if the
> last argument to a function is a delegate, allow moving the delegate's
> body outside of the function:
>
> fun(a, b, c) { body }
>
> |
> V
>
> fun((a, b, c) { body });
>
> As far as Walter and I could tell, there are no syntactical issues
> created by such a lowering. But we've been wrong about that in the past
> (me 10x more often than him).
>
>
> Andrei
I think it will be great to have it in language!
But what about:
unittest {
}
It could be just function call with delegate as a last parameter, but in
the context e.g. of class body it is not possible to call functions...
If there would be kind of static function call (in the context of class
body) it would be easy to add e.g. to D runtime following signatures:
unittest(void delegate() test);
unittest(string name, void delegate() test);
unittest(string name, string group, void delegate() test);
... or maybe function definition with anonymous, immutable last parameter?
Just a few thoughts...
BR
Marcin Kuszczak
(aarti_pl)
More information about the Digitalmars-d
mailing list