xxxxxxxxxx
import std.stdio : writeln;
alias DelegateT = void delegate();
DelegateT foo() {
int a = 0;
void bar() {
a++;
writeln(a);
}
return bar;
}
void main() {
auto bar1 = foo();
bar1();
auto bar2 = foo();
bar2();
bar1();
}