Thanks Kevin and Laurent for the suggestions! It's too bad these aren't higher in google results for "clojure classloader". My current approach is essentially the same as Classlojure so at least I wasn't totally in the weeds.
Cheers, Dave On Thu, Aug 30, 2012 at 11:35 PM, Laurent PETIT <laurent.pe...@gmail.com> wrote: > Hi, > > Currently, counterclockwise is using classlojure to maintain separate > Leiningen environments for separate open projects. > > HTH, > > Laurent > > Sent from a smartphone, please excuse the brevity/typos. > > Le 31 août 2012 à 03:38, Dave Ray <dave...@gmail.com> a écrit : > >> 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 > > -- > 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