I'm generally of the opinion that simply using `send()` is bad form and
that for meta-programming madness `__send__()` is more suitable, if your
project makes heavy use of metaprogramming then I'd recommend staying away
from `send()` at all.

If your project is light on MP I'd be inclined to undefine the method
 itself, and rely on it's more obnoxious, double underscorred friends.

Lee Hambley
--
http://lee.hambley.name/
+49 (0) 170 298 5667


On 19 July 2013 17:37, Ash Moran <[email protected]> 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.
>
>
>

-- 
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.


Reply via email to