On Tuesday, 2 May 2017 at 17:08:11 UTC, Juanjo Alvarez wrote:
struct S {
int someState;
void some_foo() { return this. someState;}
void delegate() foo;
void enable() {
foo = &some_foo;
}
}
That's actually illegal in D. It will compile, but has undefined
behavior because the com
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
Hi!
I would like to have a "proxy" delegate, let's call it "foo" that
could point to a method or another, let's call them "fast_foo" or
"slow_foo" on the same object. This way depending on some
conditions I could switch at runtime from one set of methods to
others with a "switchFoo(" fast") m