Stuart, You're right that it breaks identity. How about a different approach then - I can get the list of referred vars from a namespace, and vars can cary metadata. A natural way to add more flexibility would be to add a flag - let's call it :export - to referred vars that I'd like for namespaces that subsequently use mine to also refer. A var marked with :export would effectively propagate through any number of calls to (use).
I've thrown together a quick POC that seems to work (although it's obviously limited and far from optimal in how it works). The full code of the example is on Gist <https://gist.github.com/4474008>. Ideally, I'd like to have either (use) or (refer) propagate :export'd vars in a similar fashion. Can you see problems with this? - Adam On Monday, January 7, 2013 3:17:55 AM UTC+1, Stuart Sierra wrote: > > I've said it before and I will keep saying it: copying symbols by > interning vars breaks the identity of the original vars. It breaks dynamic > binding, with-redefs, and the ability to redefine functions at the REPL. > > Clojure has a two perfectly good mechanisms for making vars available in > other namespaces: > > 1. `refer`. Define a public function that `refer`s all the symbols you > want. It's an extra step for the user, but that's good because it makes it > evident that extra symbols are being added. > > 2. `load`. If you have N namespaces with no clashing symbols, then you > only need one namespace. If you want to split it across multiple files, use > `load`. `clojure.core` does this. > > -S > -- 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