Hi, Instead of "low level" 'load call, you should use either 'require or 'use in the REPL.
That would allow you to either (require 'bar) => will not try to get a fresh content of bar from the filesystem if ns bar already exists (require 'bar :reload) => will force ns bar to be reloaded from the filesystem (require 'bar :reload-all) => will do what you want, e.g. force every directly or indirectly namespace used or required from namespace bar to be reloaded from filesystem. HTH, -- Laurent 2009/8/23 Conrad <drc...@gmail.com> > > Hi- I have a bug in my code related most likely to my misunderstanding > of some arcane corner of Clojure namespaces... can someone tell me > what I'm missing? > > First, create the following 2 files: > > --- foo.clj --- > (ns foo) > (def x (ref true)) > --- end foo.clj --- > > --- bar.clj --- > (ns bar > (:use foo)) > (defn change-x [] > (dosync (ref-set x false))) > --- end bar.clj --- > > Now, run the following from the REPL: > > user=> (load "bar") > user=> (in-ns 'bar) > bar=> x > #<r...@15291cd: true> > bar=> (change-x) > #<r...@15291cd: false> > bar=> x > #<r...@15291cd: false> > bar=> (load "bar") > bar=> x > #<r...@15291cd: false> > > As you can see, the value of x remains false, despite the fact that I > reloaded the file... can someone explain to me why reloading the code > doesn't cause the variable x to be redefined back to true? It seems if > variables in "used" files aren't re-def'ed then you can't properly re- > load your code if you have multiple namespaces... > > Thanks! > Conrad Barski > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---