Create a new namespace+file my.server where the *server* resides, then let my.query and my.update use my.server.
Jonathan On Sat, Jun 18, 2011 at 3:52 PM, Matt Mitchell <goodie...@gmail.com> wrote: > Hi, > > I have 3 namespaces, each with functions that relate to the name of the ns: > > core -- contains config and *server* var > query -- contains fn's related to querying > update -- contains update/delete fn's > > I want to be able to "use" my core ns in my application, and call all of > the public fn's in core, query and update without going through the query > and update ns aliases. This would be as simple as specifying "use" in the > core ns when defining the namespace. > > The problem is that the query and update ns's need to access a var called > *server* in the core ns. The *server* var is set using binding like so: > > (use 'my.core) > (with-server :whatever-sever-name > (delete-by-id "xyz")) > > delete-by-id is an fn in the update namespace, and looks something like: > > (defn delete-by-id [id] (*server*/delete-by-id id)) > > The problem is *server* belongs to core, so that doesn't work. If I pull in > core to the update ns, I get a circular reference error. > > My question is, how can I keep my code separated as it is, but have it so I > use core, and automatically bring all the fn's in to the same scope, all > while sharing the core/*server* var? I could easily push all the fn's in the > same ns, but that seems messy. > > Thanks, > Matt > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en