On Monday, 1 February 2016 at 21:40:45 UTC, Enjoys Math wrote:
module signals_and_slots;
How do you implement this template called like:
void onColorChange(in Color) {
// do something with color
}
auto slots = Slots!(void delegate(in Color), Color);
slots.connect();
auto color = Color(0.0,
On Tuesday, 2 February 2016 at 17:35:25 UTC, Chris Wright wrote:
On Tue, 02 Feb 2016 15:59:06 +, Atila Neves wrote:
[...]
I've seen this sort of thing before. A blogger I used to
follow, Jeremy Miller, implemented an event broker using this
pattern. I don't like it. It requires a new
On Monday, 1 February 2016 at 21:44:28 UTC, Enjoys Math wrote:
On Monday, 1 February 2016 at 21:40:45 UTC, Enjoys Math wrote:
module signals_and_slots;
import std.algorithm: remove;
[...]
D's signals & slots:
https://dlang.org/phobos/std_signals.html
I looked at that and perhaps I'm not
On Tuesday, 2 February 2016 at 14:49:21 UTC, Gerald wrote:
On Monday, 1 February 2016 at 21:44:28 UTC, Enjoys Math wrote:
On Monday, 1 February 2016 at 21:40:45 UTC, Enjoys Math wrote:
module signals_and_slots;
import std.algorithm: remove;
[...]
D's signals & slots:
On Tue, 02 Feb 2016 15:59:06 +, Atila Neves wrote:
> struct String1 { string s; }
> struct String2 { string s; }
I've seen this sort of thing before. A blogger I used to follow, Jeremy
Miller, implemented an event broker using this pattern. I don't like it.
It requires a new type for each
On Tuesday, 2 February 2016 at 15:59:06 UTC, Atila Neves wrote:
Slots are named: the methods are slots. Signals can be named if
you use only one struct as the parameter, as above. The signals
would be String1 and String2, the slots watch1 and watch2.
What I meant is that the connect call
module signals_and_slots;
import std.algorithm: remove;
struct Slots(DelegateType, ArgTypes...) {
this() {
}
// How would you implement this?
void call(ArgTypes args) {
foreach (dg; delegates)
dg(args);
}
On Monday, 1 February 2016 at 21:40:45 UTC, Enjoys Math wrote:
module signals_and_slots;
import std.algorithm: remove;
[...]
D's signals & slots:
https://dlang.org/phobos/std_signals.html