Arc Forumnew | comments | leaders | submitlogin
3 points by rocketnia 5258 days ago | link | parent

At the risk of sounding like a broken record, I think Lathe's namespaces already embody lots of the ideas people are talking about here. :-p

In this case, Lathe provides two forms in its more-module-stuff.arc module, 'packing and 'pack-hiding, which work like 'packed but only put certain parts of the "my" namespace into the package object. That way, the internals don't get imported.

The 'packing and 'pack-hiding forms are in a separate module only because they aren't fundamental to Lathe, but in fact, I've never actually wanted to use them. Just having separate namespaces is enough for me, 'cause when I want to have unobtrusive definitions, I can just create a throwaway namespace to put them in.

-

@evanrmurphy http://arclanguage.org/item?id=11975

For what it's worth, Lathe's namespaces are used like this, generally:

  (--specify-what-creates-the-namespace--
    --specify-functions-etc-using-the-namespace--)
The main point of this in Lathe is so that the form can clean up after itself using an 'after form. The return value capability is also nice.

An alternate namespace implementation might take this format so that it could search-and-replace names in its body at macro-expansion time. That was my original plan for Lathe's namespaces, but I soon realized a simplistic code walker wouldn't do, and I didn't really want to write a sophisticated code walker unless I had a whole new language in mind. Also, I doubt this approach would translate very well to the REPL.