I generally use the ns macro to jump around my namespaces (like I use ls to change directories in the shell) , and use a convenience function I wrote called ns-nuke, which gets rid of all functions defined in that ns. Then I use reload, another convenience function, which just uses that namespace again. This works for me but then again my code is rather small. If you are using emacs, you can do C-c C-k to recompile that namespace as well. I used to restart my repl all the time but I don't ever do that anymore after making ns-nuke (and a function to add stuff to the classpath :)) You can also use user.clj to preload convenience functions, so that you no longer need to experience the pain of a million (use) statements on a restart.
Here are my functions that they may be helpful to you: (defmacro ns-nuke ([] (let [current-ns# (symbol (str *ns*))] `(do (println "NUKING namespace" (quote ~current-ns#)) (clojure.lang.Namespace/remove (quote ~current-ns#)) (ns ~current-ns#))))) (defmacro reload [] `(do (use :reload-all (quote ~(symbol (str *ns*)))))) --Robert McIntyre On Sun, Sep 26, 2010 at 5:56 PM, Michael Ossareh <ossa...@gmail.com> wrote: > How are other people handling the process of reducing code in their > projects? > Situation: We've built a product, very rapidly thanks to being able to > produce stuff very quickly in clojure. However now that it is somewhat > settled I'm in the process of paring down the code, removing defunct fn's, > etc. > Problem: You compile your code, you test it, you pare down some functions or > rename a function and push that into the VM - hit refresh, everything works. > However there is a chance you are actually using a function which you have > removed from the source code. i.e. you missed a reference in another file or > something similar. Most recently I removed a pointless wrapper fn around > another fn, however the wrapped fn was declared private. Everything seemed > to be working until I compiled the source and found out that my fn's were > calling the wrappee which was still in scope within the VM . > I've now started to use lein uberjar to point out cases that I'm doing this > - and it's fine for now, however it is a bit of a throwback to the pains of > Java development. > Another solution I've been using is to regularly restart my running clojure > instance, however this has the annoyance of me losing all my locally defined > vars during dev. > Thanks for any suggestions on 'dev best practices' in this space. > Cheers, > mike > > -- > 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