Forgive me, the first example was meant to be The following code wont compile: (defn y[]) ((x)) (defn x [] nil)
On Tuesday, April 15, 2014 4:39:59 PM UTC+12, Andrew Chambers wrote: > > Is there an explanation of how clojure deals with scoping and its static > checking. It seems to be a hybrid of a static language and a dynamic > language when it comes to compilation. I'll elaborate. > > The following code wont compile: > (defn x [] nil) > (defn y[]) ((x)) > > however this code will compile: > > (defn foo[] (defn x[] nil)) > (defn y[]) ((x)) > > but calling y before foo fails with a runtime exception. > > Also, the following code: > > (println "hello") > (defn -main [args] > (println "world")) > > prints "hello" at compile time > and also > "hello > world" at runtime. > > My conclusions from this is that the static symbol checker is actually > fairly stupid and is just there to provide some simple sanity, and that all > toplevel code in a namespace > is executed at compile time AND at runtime. Is this correct? > -- 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/d/optout.