On 2011-01-12, at 8:38 AM, Stuart Sierra wrote:

> One way:
> 
>     (ancestors (type the-object))
> 
> This will include every interface implemented by the object, including 
> protocols.

This seems to only work if the protocol is mentioned in the defrecord. If it's 
applied using the extend function it doesn't seem to show the protocol.

The functions bases and supers work similarly.

Unless I'm doing something really stupid, which is a distinct possibility.

Any idea how to tell which of the classes returned by ancestors/bases/supers 
are protocols? I copied a function from the source that can tell if something 
is a protocol if written directly in clojure, but does not work on the results 
from those methods.

(defn protocol?
  [maybe-p]
  (boolean (:on-interface maybe-p)))


Cheers,
Bob


> 
> -S
> clojure.com
> 
> -- 
> 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

----
Bob Hutchison
Recursive Design Inc.
http://www.recursive.ca/
weblog: http://xampl.com/so




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