*I must be missing the point here, I am confused by:* * * *"*I'm implementing a simple message bus. You can tell it to publish, eg `bus.publish(message)` and this will be received by all wired handlers. It returns no meaningful result. But I also want another method with slightly different behaviour (it will probably accept a listener for the response and only deliver to one handler). Currently the best name for this I can find is "send", eg: `bus.send(message, …)`. "
I was thinking "accept a listener" as in my example. I'm intrigued? On Friday, July 19, 2013 4:37:38 PM UTC+1, Ash Moran wrote: > > Hi all > > On the subject of overriding methods, this is something I can't decide > about. > > I'm implementing a simple message bus. You can tell it to publish, eg > `bus.publish(message)` and this will be received by all wired handlers. It > returns no meaningful result. But I also want another method with slightly > different behaviour (it will probably accept a listener for the response > and only deliver to one handler). Currently the best name for this I can > find is "send", eg: `bus.send(message, …)`. > > Now the only problem with this is that as Object defines #send, so if you > tell the wrong thing to "send", you get the unhelpful error "<some message > description> is not a symbol". You can still send arbitrary messages to a > message bus with #__send__. Arguably if it was passed into something that > uses #send (although I can't think how or why), that would break in a > bizarre way. > > I'm tempted to use "deliver" instead of "send", although I don't think I > like the word as much for this use. It's a bit optimistic, for a start. I > just wondered if anyone had an opinion either way on overriding methods > like this. > > Thanks > Ash > > -- > http://www.patchspace.co.uk/ > http://www.linkedin.com/in/ashmoran > > -- You received this message because you are subscribed to the Google Groups "NWRUG" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nwrug-members. For more options, visit https://groups.google.com/groups/opt_out.
