[n(o)REPL?]: Reloaded with Component

39 views
Skip to first unread message

Anatoly

unread,
May 8, 2015, 12:06:37 AM5/8/15
to modul...@googlegroups.com
I would usually create certain things in REPL and then use them against the codebase.
Once something changes in one of the namespaces, I can just (:reload-all) for that namespace, and would keep reusing the same things I already have created in the REPL.

With Reload and Component, it complicates the flow, since by (reset)'ing everything, things previously created in REPL are also lost. For example if I created a core.async channel to assoc to the system (to play with it in REPL), it will be lost after the (reset):

user=> (require '[clojure.core.async :refer [chan >!!]])
user=> (def ch (chan))
user=> (def sys (assoc (some-system {}) :signaller {:some-pipe ch}))
user=> (alter-var-root #'system (constantly sys))
#<SystemMap>
user=> (start)

Here I am replacing ":signaller" component with my own REPL based one that is based on a channel which I have access to from the REPL, and can send to it whatever I please to.

After I changed just one tiny thing in the code, I need to call the (reset) so the system is aware of it, but everything REPL based is lost, so I have to go through all these steps again in the REPL.

I could hardcode it in a file and have it available in REPL on start, but then it defeats the purpose of REPL based development.

What do you guys do to still have a sane REPL experience with Component and Reloaded while changing your code, am I missing something?

Thank you,
/Anatoly
Reply all
Reply to author
Forward
0 new messages