Hi all,

in the JIRA issue

  
http://dev.clojure.org/jira/browse/CLJ-308?focusedCommentId=35149&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-35149

Brandon Bloom mentioned that instead of extending a protocol upon
existing interfaces using `extend` (or `extend-protocol`,
`extend-type`), one could also use a (non-documented) :on-interface
directive provided by `defprotocol` which would be much faster, and he
gave this example code:

  (defprotocol Closeable
    :on-interface java.io.Closeable
    (close [this]))

I have a couple of questions about that:

  1. Where's the difference between extension and using that directive,
     especially what makes it faster?

  2. If I'd want to use that, how would I add an implementation for it?
     E.g., in the case above, where would I write that closing a
     java.io.Closable should happen with (.close this)?

  3. Can the :on-interface directive also get a vector of interfaces,
     e.g., :on-interface [java.io.Closable my.other.Interface]?

Thanks,
Tassilo

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to