Much clearer now :) Never heard of that *compile-files* var. Having to
resort to it looks pretty nasty anyway - I'd rather refactor my code
instead.

Thanks for the answer Luc!

On Thu, Feb 28, 2013 at 2:44 AM, Softaddicts <lprefonta...@softaddicts.ca>wrote:

> Of course, the expression needs to be evaluated at runtime only :)
> Presently, your jetty server gets started just after the expression is
> compiled.
>
> When you want to defer evaluation at runtime when generating compiled code
> ahead of time, you need to wrap expressions like these with this:
>
> (def server (when-not *compile-files* (jetty/...
>
> This will defer evaluation of the expression when the code actually runs,
> not after it got compiled.
>
> Remember, expressions are compiled then evaluated immediately.
> Be cautious, you can get stuff started this way while building your
> targets.
>
> It's unlikely that you want this to happen...
>
> Luc P.
>
> > So I was playing with AOT for the first time. My main reason to use it is
> > so the consumer Java code doesn't look so alien / run-timey.
> >
> > The thing is, I encountered that the following line causes `lein compile`
> > to hang:
> >
> >      (def server (jetty/run-jetty #'app {:port 8000 :join? false}))
> >
> > (for those not familiar with Jetty, the expression causes a web server to
> > launch.)
> >
> > I can sort of see why this code represents a fault, from a compiler's
> point
> > of view. But OTOH, in e.g. Java it's not that much of a rare practice to
> > bind a the result of a side-effectful op to a variable definition, right?
> >
> > My question is quite simply, why can't the given code compile? It is not
> > entirely clear to me, as I don't thoroughly understand how Clojure's
> > compiler works (or any compiler at all, for that matter).
> >
> > --
> > --
> > 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
> > ---
> > You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to clojure+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
> >
> --
> Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail from my ipad!
>
> --
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to