4 ms·
Function definitions and vars are a form of state that can accumulate in a REPL session. Its not just atoms. This can lead to issues where you decide to refact
by adamkl 6y ago
Function definitions and vars are a form of state that can accumulate in a REPL session. Its not just atoms.
This can lead to issues where you decide to refactor and rename a var (Clojure is all about concise and expressive names, so its not uncommon to do this.. At least not for me) but you might not catch every place the old var name is being used. Because both vars are still exist in the state of your REPL, everything seems to work, but once you compile your uberjar or whatever, things are broken.
A REPL isn't a replacement for good unit tests, and there are techniques for reloading your REPL state on save, but the issue of needing to keep the "REPL state in your head" is real, and not an artifact of doing things wrong. Just something that the developer needs to be aware of as a potential hiccup in the REPL experience.