Re: Importing defprotocol and deftype

2011-02-08 Thread Stuart Sierra
`defprotocol` creates a real Var, which you can `use` or `refer` just like a function. `deftype` and `defrecord` both create classes, which you must `import` using the class name. Class names have to be compatible with Java, so dashes are converted to underscores. -Stuart Sierra clojure.com

Re: Importing defprotocol and deftype

2011-02-06 Thread trptcolin
Forgive me if I'm misunderstanding, but you don't need to import a protocol to use it. If you need to actually get ahold of the protocol (say, to implement another deftype/defrecord), you can just use `require` or `use` to get ahold of it: (ns stuff (:use [com.example-ns :only [IFoo])

Importing defprotocol and deftype

2011-02-05 Thread Shantanu Kumar
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)