Oups, forget about my last post, I was under the impression you could not bind to a declared thing... wrong was I...
Luc P. lprefonta...@softaddicts.ca wrote .. > Hi Cameron, > > Use def or defvar (if you use contrib.def) to create an instance of *macros*. > Declare is used for forward references (when you reference something > before declaring it) so the compiler knows that your code is sane but it does > not "define" anything by itself. > > Yes, it may look a bit confusing at first glance but declaring > something and defining something are not the same...thing :))) > > Luc P, > > Cameron Pulsford <cpuls...@gmail.com> wrote .. > > Hello all, here is an extremely reduced version of a problem I'm not > > sure how to work around. (It's going to be a toy assembly language if > > anyone's wondering) When I call assemble in the following code I get > > the error: "java.lang.IllegalStateException: Var reader/*macros* is > > unbound." I'd like *macros* to always be rebound for whatever source > > file is being compiled and I'd rather not explicitly pass the map of > > macros (and other things not shown here) to every function in the > > hierarchy just to supply some of the bottom level worker functions > > with the information they need. > > > > Is there a way to do this? Besides cleaning up function signatures is > > this a premature optimization to begin with? > > > > (declare *macros*) > > > > (defn macro-expand [tokens] > > (map #(get *macros* % %) tokens)) > > > > (defn compile-op [op] > > (macro-expand op)) > > > > (defn assemble [{:keys [macros syms blks fncs]}] > > (binding [*macros* macros] ;; I thought binding would handle this, > > but I must be misusing it > > (let [compiled-ops (map compile-op fncs)] > > compiled-ops))) > > > > > > > > -- > > 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 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 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