On Thu, 2008-10-09 at 22:06 +0200, ntupel wrote:
> After further investigation and experimentation with macros I finally
> managed to trigger a NullpointerException:
>
> user=> (defmacro on-thread [env exp] `(doto (new Thread #(binding ~env
> (~exp))) (start)))
Ignore me. That's like doing ((prn 42)). If I wanted functions, I'd
better pass in functions. I am now using:
(defmacro on-thread
([f]
`(doto (new Thread ~f) (start)))
([env f]
`(doto (new Thread #(binding ~env (~f))) (start))))
which seems to do what I wanted.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---