Fork me on GitHub
#component
<
2022-05-01
>
Serafeim Papastefanos10:05:08

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

(comment
  (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 ?

dorab16:05:58

If you haven't already, see Sean's presentation at London Clojurians https://www.youtube.com/watch?v=gIoadGfm5T8

dorab16:05:16

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.

dorab16:05:59

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

seancorfield17:05:23

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

seancorfield17:05:50

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 http://clojure.org page).

seancorfield17:05:38

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 ?

seancorfield17:05:41

Read the link I posted.

seancorfield17:05:51

(it's explained better there than I can)

🙌 1