| I realized there is a problem with how the auto-uniqs are generated. They are generated only once when the macro is defined, instead of being generated every time the macro is executed. I am currently trying to figure out how we can fix this. It looks like defmacro! from Let Over Lambda would be a good place to start. Edit: Here's what I have so far (let uniqs (map (fn (v) `(,v (uniq ,v)))
(keep auto (flat body)))
`(defmacro ,name ,args
(let ,uniqs
,@(subst auto
[alref uniqs _]
(tree body)))))
The problem I am running into is the variables need to be unquoted the same number of times they are backquoted. Does anyone have any ideas on how to fix this?Edit: I believe I have discovered why Clojure makes the auto-gensyms as part of the backquote. The macro is only executed once so it is impossible for every symbol to be replaced within each execution of the code when the implementation of the autos are through a macro. OTOH the backquote is executed every time new code is generated. This makes it possible to have every place the generated code is used, to have its own unique set of symbols. If anyone has any ideas about how this could be done differently, feel free to explain. |