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-aot-compiled.jar you.ns --port 9090



On Thursday, February 28, 2013 8:47:36 AM UTC+8, vemv wrote:
>
> 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.


Reply via email to