Reply to TSalm,
Hello,
I would do something like this, but this return me an execution error
: object.Exception: Stack Overflow
// --------CODE--------
class A
{
void delegate() dg;
void doIt()
{
dg();
}
}
class B
{
A a;
this()
{
a = new A;
a.dg = { doSomething(); };
}
void doSomething() { }
}
void main()
{
auto b = new B;
b.a.doIt();
}
// ------END CODE------
Is this a bug or have I do something wrong ?
Thanks in advance for your help,
TSalm
If this is d1.0 the error is that you are allowing an anon delegate to escape
the enclosing function.
a.dg = &this.doSomething; // this would be ok if that helps.
if it is 2.0, I think this is correct.