Hi guys! Is this code valid? It works well but I have doubt about passing the memo as param function.
(defn ?task
[opts]
(m/sp
(m/? (m/sleep 500))
(let [?memo1 (get opts :?memo1)]
(str "Res task: " (m/? ?memo1)))))
(defn ?other-task
[opts]
(m/sp
(m/? (m/sleep 400))
(let [?memo1 (get opts :?memo1)
?memo2 (get opts :?memo2)]
(str "Res other-task: " (m/? ?memo1) ", " (m/? ?memo2)))))
(defn ?main
[]
(let [?memo1 (m/memo (m/sp (m/? (m/sleep 600)) "OK"))
?memo2 (m/memo (?task {:?memo1 ?memo1}))]
(m/join vector
?memo1
?memo2
(?other-task {:?memo1 ?memo1 :?memo2 ?memo2}))))
(m/? (?main))yes, nothing wrong here
Thanks leo!
Is missionary a good fit as a simple component lifecycle framework (think: Component/Mount/Integrant)? It supports cancellations, supervision trees, it is able to natively reacts to changes in configuration — it tempts me to try. Any hidden pitfalls?
@n.litened Thanks for your https://nextjournal.com/N-litened/missionary-for-dummies, I've been using missionary quite a bit but never did the in depth dives like you and it's helped me a ton. My live-reload situation in clojure nowadays is nearly the same as it is in clojurescript: saving a file reloads the affected namespaces. defonce + before-ns-unload of clj-reload makes my environment constantly up-to-date and hot-reload very fast. I think most lifecycle frameworks are way over the top and try to reinvent things that clojure does fine already. But perhaps I just never ran into the use-case of needing to be really flexible with my order of bringing systems up or down. My experience with all of them (except maybe mount) has been that it overcomplicates.
Yeah, I also tend to stick to simple Mount to manage state and reloads. However I’ve noticed that Missionary tends to “infect” all other parts of code of a project — so I’ve just wondered, maybe it makes sense to go with “missionary everywhere”? :) I wonder if anybody had gone that route and had opinion to share
Yeah, for me, so far so good on using missionary processes extensively.
And yeah, before-ns-unload in clojure often includes closing running missionary process, in clojurescript I (declare some-process) (when some-process (some-process)) to close it before restarting (during namespace load).