This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-28
Channels
- # admin-announcements (1)
- # aws (2)
- # beginners (21)
- # boot (28)
- # braid-chat (1)
- # cider (51)
- # cljs-edn (7)
- # cljsjs (35)
- # cljsrn (2)
- # clojure (85)
- # clojure-chicago (7)
- # clojure-czech (1)
- # clojure-gamedev (3)
- # clojure-poland (2)
- # clojure-russia (80)
- # clojure-sanfrancisco (1)
- # clojure-uk (5)
- # clojurebridge (9)
- # clojurescript (68)
- # cursive (29)
- # datomic (23)
- # emacs (2)
- # hoplon (94)
- # jobs-discuss (15)
- # juxt (2)
- # liberator (2)
- # luminus (16)
- # mount (12)
- # off-topic (7)
- # om (57)
- # onyx (58)
- # proton (10)
- # re-frame (9)
- # reagent (38)
- # remote-jobs (2)
- # rum (12)
- # untangled (136)
Hey @tolitius . I have a state in a library. now the state have dependencies which are not known at compile time, so I have tried to pass them as arguments using mount/start-with-args. I suspect that this is not supported, right? Every state I pass as an argument is passed as a mount.core.DerefableState and every non-state argument is passed fine. This is of course a circular dependency by definition, but is doable with component, since all the dependencies are defined explicitly there. Since mount relies on the compiler- is there a way to pull this off?
@ido: while I am of the opinion that mount states are not suitable for libraries, I think you can pull this off by passing the var as an argument. Then you can deref
that var in the state that depends on it. This is possible with mount-lite
, but I suspect it is the same for mount
.
@arnout: I am now starting to feel this in my fingers after I wrote a large mount-common library for use in house here. Maybe this was a mistake. But I'll try the var/deref
approach first.
@arnout: deref
is not enough. I now have a mount.core.NotStartedState
in hand. Mount just won't start it. @tolitius is there anyway to convince mount that those are dependencies?
@arnout: do you have any experience migrating from mount
to mount-lite
? I am having heresy thoughts
@ido: Did you require the dependency state somewhere? That is required for mount
to recognise and register the state.
So, your code looks something like this?
(defstate foo
:start 'started)
(defstate bar
:start (do-something-with (-> (mount/args) :bar-dep deref)))
(mount/start-with-args {:bar-dep #'foo})
About migrating, I had not written a lot of mount before creating mount-lite. You can read the documentation here http://www.functionalbytes.nl/mount-lite/index.html, and decide for yourself. In the end, both libraries have the same goal, just with a tad different approach.