you can use the *compile-files* flag
if you need to differentiate compiling versus running contexts.

This will be useful if you use AOT to create class files for later packaging.
This flag is useful to avoid global code chunks to run when they create
side effects (runtime inits, ...). You do not want these to occur at compile 
time
if you expect to package a jar file.

This applies to the JVM Clojure implementation (and probably CLR).

The flag allows to you avoid executing code at compilation time but it will not 
allow you
to create compile time definitions that will "disappear" at runtime
as  there's no "fence" between these .
It's a convenience to postpone code execution.

I did not dig much in the JS clojure implementation yet.
I suspect there's no need for this, the compiler being external to the runtime 
and 
there's no runtime eval (well a very restricted runtime sexpr serialization 
feature).
In this implementation, there's a clean split between these two contexts from
what I know at this point.

Luc P.


> 
> 
> 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?
> 
> Thanks in advance for any information or references :-)
> 
> Yong
> 
> 
> -- 
> 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
> 
--
Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail!

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