contract programming without a function
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Sat May 26 08:36:21 PDT 2007
Bruno Medeiros wrote:
> Frits van Bommel wrote:
>> Derek Parnell wrote:
>>> I don't believe that 'in' and 'out' can yet be used for nested
>>> functions or
>>> anonymous functions.
>>
[snip nested function counterexample]
>> You seem to be right about anonymous functions though.
>
> It works fine for anonymous functions too:
> ----
> void main(char[][] args) {
> function void ()
> in {
> writefln("nested : in");
> } out {
> writefln("nested : out");
> } body {
> writefln("nested : body");
> } ();
>
> writeln("END");
> }
> ----
> One just is not able to use the shortened anonymous function syntax.
Ah, I forgot to try the more explicit form. Good catch.
(Though the fact it took almost a week for someone to post this would
seem to indicate that not many people were aware of this fact...)
More information about the Digitalmars-d-learn
mailing list