Hi, I'm looking for the best way to execute some Clojure code in a more or less completely isolated environment. That is, say we load one piece of code:
A: --- (ns my-ns) (def foo [] (println "hi")) (foo) --- if a second piece of code was loaded: B: --- (ns my-ns) (foo) ; <-- This should fail --- the reference to foo would fail because they're two completely different environments. What seems to be foiling this goal is the static global clojure.lang.Namespace.namespaces. Even if I compile the code in separate class loaders, the namespace map is still shared. The best solution I've come up with so far is just to load the Clojure jar in its own class loader so there's no chance of different environments messing with each other through the global namespace table. It also means loading multiple copies of Clojure. I've looked a bit at the tryclojure/clojail approach of restricting access to (in-ns), (ns), etc and just generating a unique namespace for each piece of code. That may be an easier approach at the risk of the code being less isolated. This is being integrated into a larger, existing framework, which is where the isolation requirements come from. Thoughts? Thanks, Dave -- 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