On Tuesday, 2 May 2017 at 17:08:11 UTC, Juanjo Alvarez wrote:
Example:

struct S {
  int someState;
  void some_foo() { return this. someState;}

  void delegate() foo;

  void enable() {
    foo = &some_foo;
  }
}

unittest {
  S s;
  s.someState = 1;
  enable();
  s.someState = 2;
  assert(foo == 2);
  // fails because the delegate keeps
  // the state of the object at the
  // assignment point
}

Forget it. I just noticed the simplified example that I just posted works (once the typo of the return value is corrected) but my more complex real code won't, will try to get a simple snippet where I can reproduce the problem.

Reply via email to