Arc Forumnew | comments | leaders | submitlogin
2 points by rntz 5597 days ago | link | parent

This... isn't really an explanation. Lexical bindings of things are also determined at compile time - just not the values they'll be bound to. So you can't have a locally-bound macro, but you can let locally-bound symbols shadow macros, and there's no real reason not to.

(If that first sentence doesn't seem to make any sense to other readers: What variable or relative stack position a variable will be stored in in C is determined at compile time, but the value is not. Obviously the backend isn't the same here, but the same concept holds, at least the way arc is currently implemented; in particular, there is a parameter to 'ac that indicates what symbols are lexically and locally bound. In Python, on the other hand, the local environment is accessible at runtime, so lexical bindings are not always determinable at byte-compilation-time.)



1 point by almkglor 5564 days ago | link

  (mac helper (foo)
    `(do ,foo))
  (mac real-macro (bar)
    `(helper ,bar))

  (let helper
       (fn (x) (+ x 1))
    (real-macro (helper 1)))

-----

2 points by rntz 5538 days ago | link

This could be a poster child for hygienic macros.

-----