Re:Why your REPL experience sucks
by onetom on Wednesday November 30, 2022 @11:55AM
(#33803526)
I have a shortcut, which reloads all modified files, then re-evaluates the previously evaluated expression, within the context of the same namespace it was evaluated in previously.
This way I can be in any file, modify any `def` of `defn` and see its effect on the expression I'm working on.
After modified something, I might jump to its unit test or jump to some definition of some adjacent vars, where i see a point which I want to probe (with a function like this: `(defn ? [x] (pprint x) x)`).
Then I have 2 modified files, and my cursor is in a 3rd file and the expression I'm iterating on is in a 4th; doesn't matter, I can just keep hitting the same shortcut (Cmd-Ctrl-Enter) to see the effects of my changes on the "expression-under-test".
It's an extremely convenient workflow, which is also easy to teach to ppl!
Downside is that you can't have namespaces, which have side-effects WHEN they are loaded.
To deal with that problem, I'm using `redelay`, `rmap`, `meta-merge` & `defonce`, eg:
This way I can be in any file, modify any `def` of `defn` and see its effect on the expression I'm working on.
After modified something, I might jump to its unit test or jump to some definition of some adjacent vars, where i see a point which I want to probe (with a function like this: `(defn ? [x] (pprint x) x)`).
Then I have 2 modified files, and my cursor is in a 3rd file and the expression I'm iterating on is in a 4th; doesn't matter, I can just keep hitting the same shortcut (Cmd-Ctrl-Enter) to see the effects of my changes on the "expression-under-test".
It's an extremely convenient workflow, which is also easy to teach to ppl!
Downside is that you can't have namespaces, which have side-effects WHEN they are loaded.
To deal with that problem, I'm using `redelay`, `rmap`, `meta-merge` & `defonce`, eg:
More info on this topic is here: https://functionalbytes.nl/clojure/rmap/2020/07/04/rmap-2-up...