Arc Forumnew | comments | leaders | submitlogin
1 point by Pauan 4451 days ago | link | parent

"my eval doesn't take an environment."

Why would you do that, and how does wart handle macros, then?

---

"What would env be when the call to mac is translated to an fexpr in your scheme?"

It would be the environment where the macro is called. That is, in the dynamic binding of the macro call, x would be 4.

Using the environment of the place where the macro is defined would be static scope... which I assume wart already has, so that's redundant and pointless because you can just do this to evaluate the expression in the static scope of the fexpr:

  (let env (current-environment)
    (fexpr () nil
      (eval ... env)))
Using this scheme (which Kernel uses) allows fexprs to evaluate things in the static environment, or the dynamic environment, or both, or neither. It gives the maximum amount of power and flexibility.