Fork me on GitHub
Serafeim Papastefanos10:05:08

I tried using the simple thing, i.e something like this

  (def system (dev-system (cljcrd.conf/conf (cljcrd.conf/env))))
  (alter-var-root #'system component/start)
  (alter-var-root #'system component/stop)
and it works fine ! starting and stopping are idempotent and work fine! ty again

Serafeim Papastefanos10:05:31

@seancorfield I saw you don't recommend using the tools.namespace ; how do you "reload" a webapp when something changes ? use ring.middleware.reload ?


If you haven't already, see Sean's presentation at London Clojurians


If a function definition has changed (in a file), just re-eval that function in the REPL. If you do that every time you make any changes, the REPL state will be in sync with the file state.


Similarly, if some data file has changed, re-run any functions that maintain any state that depends on the changed data.

Serafeim Papastefanos17:05:21

thank you both for explaining


I don't "reload a webapp" -- I just eval the changed code into the REPL.

Serafeim Papastefanos17:05:49

so you change the code in your editor and re-eval immediately

Serafeim Papastefanos17:05:00

yes that's a great way of workin


Every time I change a function I hit a hot key that does "eval top block" so the new definition is in the REPL, and I use #'func references instead of func so that passing functions as HOF will pick up the new version automatically (per that page).


No "reload", no "refresh", no file watchers. Always eval everything into the REPL from your editor as you work. That's how my REPLs stay up and running for weeks.

Serafeim Papastefanos17:05:55

could you explain the #'func bit? where should i use that instead of func ? whenever a function is passed ?


Read the link I posted.


(it's explained better there than I can)

🙌 1