Thursday, February 18, 2010

Thoughts on namespace management

Konrad Hinsen recently posted some ideas for handling namespaces

There are a lot of good ideas in there, and right now I'd like to talk specifically about the proposed :like & :clone clauses.  I have a bit of a different approach.

Supposed we add a new project file, namespace_config.clj.  It would be a basic rules engine for configuring namespaces.  I'm thinking there would be a macro, extend-ns, that is roughly defined as follows. The exact implementation needs work.

This lets us set up a series of predicates & resulting actions that would be applied to each ns in the project. Everything would be done in one central location, so (hopefully) that would cut down on maintenance.


  1. Could you show an example of what you're proposing "in action" ?

  2. Sure, I'll add that later today. For now, think RailTies (sorry for non-ruby backgrounds).

  3. I'd also like to see an example. In particular, I wonder what the predicate function would look like in practice. A priori, I would expect the applicability of a rule to a namespace defined in the namespace rather than in the rule, so I am wondering what you had in mind.

  4. Still working on this, it's way harder than I thought. I'll keep you posted.