Rich Hickey <richhickey <at> gmail.com> writes:

> 
> An updated version of the code for datatypes[1] and protocols[2] is
> now available in the 'new' branch[3].

I've converted some code that used gen-class to use deftype and defprotocol and
the results are great so far.  The code is shorter, easier to write and the
intent is much clearer.  I'm a big fan.

I've come across one problem though.  I've created a type with deftype that
calls a function in one of its methods:

(ns ns1.deftypetest)

(defn bar [] "bar")
(defprotocol P (foo [p]))
(deftype T [] P (foo [] (bar)))

When I compile the namespace, create an instance of the type from Java and
invoke the foo method I get:

java.lang.IllegalStateException: Var ns1.deftypetest/bar is unbound.

I guess the namespace isn't getting loaded.  Should this work?  I've created a
class in the same namespace using gen-class and that has no problem invoking the
function when it's instantiated from Java.

Thanks
Chris


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