I think of defprotocol/deftype as a dispatching mechanism to the
functions named in the protocol.  As such, it doesn't make sense
(within the scope of a single namespace) to declare the same function
name in two protocols any more than it would make sense to call defn
twice with the same name.

In the example you present, I'd say you have one protocol with
toString, and say two other protocols, each declaring their own
relevant functions, and a deftype can implement what protocols it
wishes.

On Jan 25, 2:17 pm, Raoul Duke <rao...@gmail.com> wrote:
> the signatures in the protocols of a namespace collide if the names
> are the same. what do people do about that? i think i can't even
> extract the common thing since there is no way to extend a protocol /
> no 'inheritance' of protocols?
>
> (ns bar)
> (defprotocol P1 (toString [this]))
> (defprotocol P2 (toString [this]))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to