Hi, 2011/9/14 Timothy Baldridge <[email protected]>
> While working with ClojureScript I came across a interesting question. > When compiling cljs files, how does Clojure handle macros? Normally > macros are run at compile-time, but in this case the compile-time > platform is completely different than the run time platform. My guess > is that the compiler assumes that clojure.core.first (for instance) > functions exactly the same for both the JVM and the JS versions of > Clojure, but I could be wrong there. The only other possibility I can > see is if ClojureScript has some internal JS VM it uses only for macro > expanding. > > So what is the situation here? > My understanding is that ClojureScript macros are Clojure macros, taking Clojure forms as their inputs. These clojure forms represent the literal ClojureScript data passed in the macro call in the cljs code. The macro plays with its input forms as usual, and gives back clojure forms which will be seamlessly retrofitted to ClojureScripts forms in the right place, before "ClojureScript to Javascript 'compilation'". HTH, -- Laurent > > Thanks for your time, > > Timothy > > -- > “One of the main causes of the fall of the Roman Empire was > that–lacking zero–they had no way to indicate successful termination > of their C programs.” > (Robert Firth) > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > [email protected] > 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 post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
