When I declare using defprotocol:

(defprotocol IFoo
  (bar [this] "some doc"))

and then using deftype:

(deftype Foo
  IFoo
    (bar [this] "from Foo::bar"))

I noticed there is an interesting difference in the way I need to
import them in another namespace:

  (:import
    (com.example_ns IFoo)  ; importing Foo here gives error (notice
underscore)
    (com.example-ns Foo))  ; importing IFoo here gives error (notice
dash)

Can somebody explain the rationale behind this? The dash character is
not valid inside a Java package names so a protocol not supporting it
is understandable. But when I deftype something, is it not supposed to
be consumed from within Java-the-language?

Shantanu

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