Defer in D

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 21 04:20:12 PDT 2016


On 20/03/2016 16:57, Nick Treleaven wrote:
>      void opCall(ARGS...)(void delegate(ARGS) call, ARGS args)
>      {
>          stack.put(() => call(args));
>      }

Maybe this method would be nice (does the same thing):

Deferrer d;
...
d.capture!writeln("i = ", i);

The name capture makes it clearer the arguments are not taken by 
reference IMO.

@Xinok: I suggest for now you put it in a Github repository somewhere.


More information about the Digitalmars-d mailing list