32

In clojure I have lines like this that define default values:

(def *http-port* 8080)

I've now decided to formalize these kinds of values into a configuration unit and I would like to undefine the value *http-port* so that I can find the locations that still refer to this value and change them to use the new value. I'm doing a refactoring in other words by moving the value to a different location.

The way I've been doing this is to quit slime and try to restart the slime session. During maven's compile phase errors like these are picked up and I can find and fix one reference at a time. I then fix the error, wash rinse and repeat. This is obviously frustrating.

How would I do this while connected to a slime session?

Pieter Breed
  • 5,579
  • 5
  • 44
  • 60

1 Answers1

43

If I understand you correctly, ns-unmap should do what you want:

user=> foo
java.lang.Exception: Unable to resolve symbol: foo in this context (NO_SOURCE_FILE:1)
user=> (def foo 1)
#'user/foo
user=> foo
1
user=> (ns-unmap (find-ns 'user) 'foo)
nil
user=> foo
java.lang.Exception: Unable to resolve symbol: foo in this context (NO_SOURCE_FILE:1)
bfontaine
  • 18,169
  • 13
  • 73
  • 107
Hugh
  • 8,872
  • 2
  • 37
  • 42