I've now tried implementing the Student class (see previous posts) using 
reify, deftype, defrecord, and proxy, in each case specifying that they 
implement an interface (SteppableStudent) that extends the MASON Java 
interface Steppable.  (The extended interface adds one method.)

The reify and deftype versions are as fast as my original gen-class 
version--a little bit faster, even--so that my all-Clojure version (using 
classes from the MASON library written in Java) can run at about half the 
speed of a pure Java version.

However, in all versions (gen-class, reify, deftype, defrecord, proxy), I 
can only get maximum speed by the same awkward trick that I used with 
gen-class:  I remove a type hint in Student.clj, compile all of the files, 
then I add back the type hint in Student.clj and recompile it.  If I don't 
do this, I either get "java.lang.Exception: Cyclic load dependency"; or I 
can't compile Student.clj because Students doesn't exist, or can't compile 
Students.clj because Student doesn't exist.

I thought I'd summarize all of this here for anyone who had followed this 
thread.  I'll may post a new question, with additional details, in a new 
thread in this group, or in StackOverflow.  I want to try some other things 
first.

Although I have not yet solved the original problem, I've learned a great 
deal as a result of the suggestions people offered in this thread.  Thanks!

(I still wonder whether my problem can only be solved by a change to the 
Clojure compiler, but I have to investigate and think about the problem a 
bit more.)

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