I realize that mount state cannot be copied around before it's started (or it won't get started). Is this intentional behavior, and if so why?
mount.core=> (defstate my-state
:start (rand-int 50))
#'mount.core/my-state
mount.core=> (def my-map
{:a my-state
:b my-state})
#'mount.core/my-map
mount.core=> (start)
{:started ["#'mount.core/my-state"]}
mount.core=> my-map
{:a #object[mount.core.DerefableState 0x6673584c
{:status :ready,
:val #object[mount.core.NotStartedState 0x1c4a2946
"'#'mount.core/my-state' is not started (to start all the states call mount/start)"]}],
:b #object[mount.core.DerefableState 0x6673584c
{:status :ready,
:val #object[mount.core.NotStartedState 0x1c4a2946
"'#'mount.core/my-state' is not started (to start all the states call mount/start)"]}]}
I'd kinda expect the derefable states in my-map to get started too
@vale Mount starts vars, but my-state in the map is not a var, it's just a value. If you put the var #'my-state
in your map instead, they will all reference the same state and become started at once.