On 27 Mar 2006 at 15:57, Jonathan Gardner wrote:

> Unless I can declare a signal BEFORE it is signalled, you cannot
> connect to it, nor can I signal it.

In my home-rolled (before Mochikit) js library. I have an event
handling
module that is more like a party line phone.

"events" are broadcast on arbitrarily named channels. Any object can
register to listen on any channel. Any object can send an "event" to a
channel, and every object listening on the channel gets that event. If
no
object is listening, the event goes no where.

There's no way to know in advance if that event will be used, and in
many
cases there's no way to know if anyone will send that event.

So requiring to register a channel name in advance would complicate the
code quite a bit. Because event originators would have to register all
channels they might use, and event recipients would also register the
same
channel names as well, since they want to receive events on those
channels.

also, there's no way to be sure that event originators get initialized
before recipients.. Also channel names are created on the fly as
needed.

So, I treat "events" as just a named party line to which any object can
send an event (an object with attributes). And any object can request
receiving any event on that channel.

very simple, quite flexible.

so in my opinion registration isn't very helpful. If some object wants
to
receive events for a signal not yet registered, then it should get
registered automatically. Same for senders that wish to signal an
event.

Regarding typos and stuff. If I have to register for an event and then
signal it, I may be typing that signal name more than once.. So there's
a
chance for confusion there. Anyway its not so hard to debug unexpected
problems, just have a logger that logs all signals raised..



--
Brad Clements,                [EMAIL PROTECTED]    (315)268-1000
http://www.murkworks.com
AOL-IM or SKYPE: BKClements


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---

Reply via email to