Well, I did propose a hackish extension, 'symeval, some time back. I should probably push the extension onto Anarki. T.T
(= pusher cons)
; push is defined in arc.arc
(mac my-push (e l)
`(symeval!pusher ,e ,l))
(let pusher (fn (x ls) (+ ls (list x)))
(prn (my-push 'a '(b c d)))
(prn (pusher 'd '(a b c))))
Basically symeval is a non-overrideable special form (on the same level as 'set, 'if, etc.)
I think 'symeval is a possible solution to this problem, and I'm glad somebody thought of it before me. But the question is why you wouldn't use 'symeval on every free variable in your macro template, just in case some newbie decides to let bind one of your "global but internal" names. If you did use 'symeval everywhere (or automatically) you would have something closer (but still a poor approximation) to scheme's hygienic macro system. I think the automatic solution to be found there is more interesting.
I tried that. It doesn't work without knowing which variables are local and arc currently has no way of finding out, what the binding forms are, because all macros are unhygienic.
example:
(let list '(foo bar) (do (prn list)))
| | unbound | | |
mac | mac | function
function function
=>(let (global list) '(foo bar) (do ((global prn) (global list))))
We know that let binds its first argument and aif binds self, but since macros are turing-complete, this cannot be automatically inferred.
expand any macros in sub-expressions, then look at them. That's the advantage of avoiding "first-class macros", whatever their imagined advantages might be. ^^
It's enforced. For example, you can assign a macro to 'if, but it'll never be used: 'eval will always interpret 'if in its sense, and will never look at your macro.