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

Which, incidentally, is already possible with namespaces + eval accepting a second parameter:

  (mac module (name . body)
    `(let ,name (new-namespace)
       (eval '(do ,@body) ,name)
       ,name))
Such a tiny change (namespaces + eval) has a lot of power, I think. Personally, I'd prefer this:

  (w/namespace (new-namespace)
    (load "foo.arc")
    (bar))
Because then you can do this:

  (import foo "foo.arc"
          bar "bar.arc")

  (w/namespace foo
    ...)

  (w/namespace bar
    (load ...)
    (load ...)
    ...)

  (w/namespace (current-namespace)
    ...)
  
  (w/namespace (current-environment)
    ...)

  (w/namespace (table)
    ...)
But it's not a big deal, since both `module` and `w/namespace` are easy to write as macros. So you can use whichever you want. :D