I've hit another mystery (to me), that I hope someone can explain.

Why doesn't the following work?

(defn tst[] (pr 4))

(defn trd[]
  (let [f #(eval '(tst))]
    (. (Thread. f) start) ))


It seems that a separate thread can not EVAL any defined functions. If
I change the above to remove the thread, the function works fine, or
if I keep the thread but remove the eval (define the function to
invoke TST directly), it will work. In particular I hit this problem
trying to get a remote socket REPL loop going, similar to the wiki
example. I have it working for simple stuff like (+ 2 3), but
attempting anymore more complicated than a clojure built-in instantly
fails (unable to resolve symbol). And this failure appears to be
related directly to threading. (Remove the thread and I CAN make
remote function calls).

I have a feeling I'm missing something regarding threads / variables /
root bindings, etc. Any ideas?

--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to