Arc Forumnew | comments | leaders | submitlogin
2 points by rocketnia 5032 days ago | link | parent

The most immediate concern is that you can't use macros that way. Lathe's[1] module system overcomes this by implementing namespaces as table-backed macros. However, for that to work it needs to store the namespace macros themselves as global variables, and you still need to refer to every utility using "name-of-the-namespace.name-of-the-utility" or the like. This is almost enough, IMO.

Recently I've been wondering whether there's something we can do to have unqualified imports in Arc (so we can just say "name-of-the-utility"). Essentially it would mean replacing the environment with another environment with different bindings (or different rules for looking up bindings), not just different values; that way we don't overwrite the variables from our existing environment and mess things up, and we get library hackability since the new bindings can be intentionally modified.

Technically we may be able to replace bindings in the environment rather than replacing the whole thing. I don't know which way is better.

Is Racket's environment mutable in the right ways for this? If not, aw's ar[2] can still do it, since it represents the Arc environment as a table. Penknife[3] represents it in the same sort of way, specifically motivated by this namespace strategy (but I'm not to that point yet).

[1] https://github.com/rocketnia/lathe

[2] https://github.com/awwx/ar

[3] https://github.com/rocketnia/penknife