tolitius / mount

managing Clojure and ClojureScript app state since (reset)
Eclipse Public License 1.0
1.22k stars 88 forks source link

Lazy start in :clj mode #126

Open xiongtx opened 1 year ago

xiongtx commented 1 year ago

The documentation for lazy start makes it sound like something that's only supposed to be enabled for :cljc mode, but it seems to apply in the default :clj mode as well.

Making sure we're in :clj mode:

> @(var mount.core/mode)
#<Atom@102525ec: :clj>

W/ the following state in namespace foo:

(defstate test-state
  :start 1)

And accessing from a different namespace:

> foo/test-state
#<DerefableState@6425c0d5: :not-delivered>

> @foo/test-state
#object[mount.core.NotStartedState 0x4ae19e09 "'#'foo/test-state' is not started (to start all the states call mount/start)"]

> foo/test-state
1

Looking at the code, it seems there's no mode check when dereferencing.