On Sun, Sep 26, 2010 at 2:56 PM, Michael Ossareh <ossa...@gmail.com> wrote:
> 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.

It's actually pretty easy to identify what defns don't get run in a
namespace with a judicious use of alter-var-root and metadata. I've
implemented this in Radagast, my simple test coverage tool:

    http://github.com/Seajure/radagast

It's not _that_ useful for test coverage because it doesn't handle
branch-level metrics, but as a "what functions are dead weight that's
not getting called" detector it works great!

> 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.

We call this "getting slimed". There is currently no solution for this
at least in Emacs. I would like to have a version of
slime-compile-file that would remove all vars in the namespace before
recompiling, but I haven't had the chance to implement it.

Patches welcome, of course.

> 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.

Restarting your VM should not be an annoyance. If you are creating
data or functions in order to test, you should create them in your
test suite. That way it's easy to run a fully-fresh run of the tests.
You don't even have to restart your swank VM; it should be totally
separate to avoid contamination.

-Phil

-- 
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

Reply via email to