On 16 май, 05:57, ataggart <alex.tagg...@gmail.com> wrote:
> Perhaps you misunderstand protocols.  Protocols don't support a
> hierarchy, thus you don't extend them; you have types implement/reify
> them.  Any "extending" you do will be against a type.

By extending the protocol I mean "extending the polymorphism of
the protocol's methods to call the supplied functions when an
AType is provided as the first argument" (http://clojure.org/
protocols)

> Further, a protocol is a set of abstract function definitions; it is
> not a type, as such the notion of "functions that accept or return
> protocols" doesn't apply.  For example, with the following:
> (defprotocol P
>   (foo [x])
>   (bar-me [x] [x y]))
> It would make no sense to say some function "takes an instance of P",
> unless you're talking about the two functions, foo and bar-me.

While in theory protocol is a set of abstract function
definitions, in actual implementation protocol structure includes
set of extenders and implementing functions. This state (what
types currently implement the protocol and how) is what I really
want to be able to manipulate. The way it is tied to the protocol
definition and changed by the extend function seems to cause the
problem.

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