I had code something like this:

(defn- foo [args] body)

(defmacro bar [args] body)
  `(foo ~some-args (fn [~more-args] ~...@body)))

and it complained that foo was not public when I invoked bar from
outside its home namespace.

OK, easy workaround, I thought:

(defmacro bar [args] body)
  (let [x foo]
    `(~x ~some-args (fn [~more-args] ~...@body)))

And now at the line BEFORE the line that uses the macro:

#<CompilerException java.lang.ExceptionInInitializerError (xxx.clj:182)
>

The cause exception turns out to be:

Caused by: java.lang.ClassNotFoundException: mumble.frotz.foobar
$foo__165
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:
55)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:247)
        at clojure.lang.RT.classForName(RT.java:1487)
        at clojure.lang.LispReader$EvalReader.invoke(LispReader.java:928)
        at clojure.lang.LispReader$DispatchReader.invoke(LispReader.java:540)
        at clojure.lang.LispReader.read(LispReader.java:145)
        at clojure.lang.RT.readString(RT.java:1191)
        ... 24 more

Can anyone tell me what the hell is causing this? How do I work around
it, without making "foo" public?

I have also tried

(defmacro bar [args] body)
  (let [x #(foo %1 %2)]
    `(~x ~some-args (fn [~more-args] ~...@body)))

with nearly identical results:

Caused by: java.lang.ClassNotFoundException:mumble.frotz.foobar
$bar__169$d_r__171

That is, now it's the #() defined closure that it apparently can't
find.

This is a showstopper. I can't make further progress on this project
until I know how to fix this!
--~--~---------~--~----~------------~-------~--~----~
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