http://onclojure.com/2010/02/17/managing-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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro extend-ns | |
[pred & ns-clauses] | |
(if (pred a-ns) | |
(let [clauses (apply hash-map ns-clauses)] | |
`(do | |
(import ~@(:import clauses)) | |
(use ~@(:use clauses)) | |
(require ~@(:require )))))) |
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.