Signals far from Slots

Jim Hewes via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 8 07:37:57 PDT 2014


Thanks Ali,

In the second part of that example I was hoping it was understood that 
Bar generates it's own signal. Sorry, I guess I wasn't clear; I was just 
trying to reduce code.

I think maybe I'm really looking for a way that BarContainer doesn't 
have to know that Bar and Foo are connected. One way I used to do this 
was to have a central EventManager object that all other objects knew 
about and it would be the traffic cop for events. So you have the 
traditional Java type of Observer implementation and then listeners 
register with the EventManager saying that they are interested in a type 
of event while signalers send all their events to the EventManager. 
Since signals and slots are intended to have some advantage over the 
Java way, I wondered if there was a better way to handle the setting up 
of the connection. (Signals and slots decreases coupling of objects, but 
then some controller object needs to know about them enough to connect 
them.)

Sorry, maybe this is the wrong place to ask such questions. I know there 
are plenty of forums for specific languages and APIs. But I don't know 
of any that just deal with general design, which is what I'd like to get 
better at.

BTW, thanks for your D tutorial! It's a big help to me.

Jim



More information about the Digitalmars-d-learn mailing list