On Thu, Feb 23, 2012 at 8:23 PM, Andreas Kostler <andreas.koest...@leica-geosystems.com> wrote: > Bump...I'm interested in this, too... > > On 21 February 2012 12:29, T.Y Chew <senatorzergl...@gmail.com> wrote: >> >> Hi all, >> >> I had a question about clojure's compilation model, which my co-worker >> suggest to redirect here :-) >> >> I wonder what clojure does during compilation of a file? Can >> side-effects occur (definition of variables, functions, macros, etc in >> the compiler)? Does clojure have an EVAL-WHEN construct for specifying >> compile-time evaluations, or is there a convention for splitting code >> across different source files? And then, how does this tie in to a >> module system?
At the very least it should be possible to have a macro like (defmacro foo [...] (if (= (System/getProperty "java.version") "1.6") `(java 6 stuff goes here) `(other version stuff goes here))) The version of Java running during compilation should be what it sees. For AOT compilation, that might not be the same as the version during deployment; otherwise it should be. Also, (defmacro foo [] (eval `(def bar ...)) `(comment)) (foo) Not sure if that could ever be of much use, or whether bar would exist at deployment time if this was AOT compiled. But bar should be visible during subsequent macro expansions. -- 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