mentions the same config twice which is a bit confusing
i.e. what if a state had three deps, we would need 6 mentions, 3 of which would be duplicates.
it complicates start / stop semantics
:deps on the defstate level adds complexity, since now it is not just start and stop, and on every start, and potentially in some cases on stop, :deps need to be taken to the count, not only by mount, but also by a developer.
Current Thinking
A concern such as identifying dependencies for a component / state should be cross cutting or/and decoupled from the component itself. Possibly a separate function, or a config, that specifies dependencies between states.
Problem Priority
If the only real goal of this is to be able to start a state with having all its dependencies started automatically, the I have two thoughts:
it is mostly needed in REPL, and mostly it is a single dep or two that are needed (i.e. config / or config and conn, etc.), which is not hard to remember
it is not a problem in (mount/in-cljc-mode) since all states are "Derefable", which means they are going to be started either on mount/start or simply when they are first referenced.
Thanks for the time spent on this :)
This problem is not new and there is an open issue that tries to start the discussion about deps.
Concerns
There are a couple of problems with the proposed solutions:
config
twice which is a bit confusingi.e. what if a state had three deps, we would need 6 mentions, 3 of which would be duplicates.
start / stop
semantics:deps
on thedefstate
level adds complexity, since now it is not just start and stop, and on every start, and potentially in some cases on stop,:deps
need to be taken to the count, not only by mount, but also by a developer.Current Thinking
A concern such as identifying dependencies for a component / state should be cross cutting or/and decoupled from the component itself. Possibly a separate function, or a config, that specifies dependencies between states.
Problem Priority
If the only real goal of this is to be able to start a state with having all its dependencies started automatically, the I have two thoughts:
it is mostly needed in REPL, and mostly it is a single dep or two that are needed (i.e.
config
/ orconfig
andconn
, etc.), which is not hard to rememberit is not a problem in
(mount/in-cljc-mode)
since all states are "Derefable", which means they are going to be started either onmount/start
or simply when they are first referenced.