[Issue 9603] Signals must work with closure delegates
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Feb 27 09:08:12 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9603
--- Comment #2 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2013-02-27 20:08:09 MSK ---
This code will work once the issue will be fixed:
---
import std.signals;
extern(C) void rt_finalize2(void* p, bool det = true, bool resetMemory = true);
class MyObject
{
mixin Signal!int actionDone;
// ...
}
class Observer
{
void watch(int i) { /* ... */ }
void watchNo() { /* ... */ }
void watchSq(int i) { /* ... */ }
void connectSignals(MyObject obj)
{
obj.actionDone.connect(&watch);
obj.actionDone.connect(i => watch(i)); // should behave as previous one
obj.actionDone.connect(i => watchNo());
obj.actionDone.connect(i => watchSq(i * i));
}
}
void main()
{
auto obj = new MyObject;
auto o = new Observer();
o.connectSignals(obj);
// ...
rt_finalize2(cast(void*) o);
assert(obj.actionDone.slots_idx == 0);
}
---
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list