Re: AOT and side-effects associated to ns initialization

2013-02-27 Thread Feng Shen
Hi, Another option: (ns you.ns // add :aot [you.ns] to project.clj (:gen-class)) (def server (atom nil)) (defn -main [& args]; command line args (reset! server (jetty/run-jetty #'app {:port 8000 :join? false}))) ;;; run it and pass command line arguments java -cp your-

Re: AOT and side-effects associated to ns initialization

2013-02-27 Thread Softaddicts
It's not nasty :) It's about cultural differences :) In the 70s/80s, dynamic languages were much more present than in the past 20 years. People understood the difference between interpretation vs code packaging for production use. Suspending evaluation at packaging time of some expressions is ok

Re: AOT and side-effects associated to ns initialization

2013-02-27 Thread VĂ­ctor M . V .
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 wrote: > Of course, the expression needs to be evaluated at runtime only :)

Re: AOT and side-effects associated to ns initialization

2013-02-27 Thread Softaddicts
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 ser

AOT and side-effects associated to ns initialization

2013-02-27 Thread vemv
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 tho

AOT and side-effects associated to ns initialization

2013-02-27 Thread vemv
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: (defn -server [] (jetty/run-jetty #'app {:port 8000 :join? false})) (fo