> So you don't want the sender to know the desired target and you also
> don't want the receiver to be aware of the sender. I'm not sure if
> that's possible... even IP has a src and dest address. :-)
I don't think I described the problem well, but after thinking about
it some more maybe the right thing to do *is* to check the intended
target on the receive end. The sender shouldn't need or even want to
know who is receiving because it's possible that another listener
(other than the intended target) might be eavesdropping in order to
provide extra functionality.
What was complicating my thinking was having multiple instances of a
major mode (for example say there are 3 PythonMode instances editing 3
different files) and an action happens on one of the views. The
action would like to send a message so that any minor modes attached
to this major mode can also process the action, but wx.lib.pubsub ends
up broadcasting the message to everything registered to receive this
message type. I was thinking there should be a way to short-circuit
the messages being sent to the other two major mode instances.
Hmmm, maybe I there is? I'm just thinking out loud here, but if each
listener would register with a topics of:
("PythonMode", "topic")
and
("PythonMode", "topic", id(major_mode))
then the actions could use Publisher().sendMessage(("PythonMode",
"topic"), stuff) to send a message to all PythonMode instances, and
use the topic ("PythonMode", "topic", id(major_mode)) to send only to
listeners registered to the specific major mode.
So, I'm back to thinking that wx.lib.pubsub is OK. It seems to be
analogous to what your EventBus class provides, I think.
Rob