Arc Forumnew | comments | leaders | submitlogin
1 point by xrchz 5898 days ago | link | parent

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.


2 points by rincewind 5898 days ago | link

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.

-----

1 point by almkglor 5897 days ago | link

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. ^^

-----