Re: How delegate context work?

2017-03-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 16 March 2017 at 14:53:27 UTC, Eko Wahyudin wrote: How D access xxx variable? where context pointer refer to? How D keep xxx variable persistent? Why xxx is not swapped out when we leave first delegate? The compiler sees that you are going to reference the variable, and copies it

How delegate context work?

2017-03-16 Thread Eko Wahyudin via Digitalmars-d-learn
I'm writing promise library, and perform testing like this.. app = new Application(); Promise p = app.exec(delegate void(){ // first delegate write("Hello"); std.stdio.stdout.flush; int xxx = 777;