On May 29, 2014, at 7:11 PM, ian.tegebo <[email protected]> wrote:
> user> (binding [*ns* (the-ns 'blah)] (defn foo [])) > #'user/foo > user> (binding [*ns* (the-ns 'blah)] (eval '(defn foo []))) > #'blah/foo clojure.core/eval evaluates a form by compiling it and then executing the compiled code. For a def form, it's the ns that is current when the form is compiled that determines in which namespace the resulting var is created. In the first case, the defn form is compiled before the binding to (the-ns 'blah) is in effect. In the second case, the defn form is quoted and remains unevaluated while the binding form is compiled. While executing the compiled code for the binding form, eval compiles the defn form (and then executes its compiled code). In this case, the defn is compiled after the binding to (the-ns 'blah) is in effect. --Steve -- 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 unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
