tolitius / mount

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

Do not start a DerefableState as a side-effect of printing #76

Closed grammati closed 7 years ago

grammati commented 7 years ago

See: https://github.com/clojure/clojure/blob/b80e1fe4b14654d943e2f8b060b0bc56e18b4757/src/clj/clojure/core_print.clj#L422-L446

grammati commented 7 years ago

Fixes #75

tolitius commented 7 years ago

thanks for the pull request!

I'll let you pick, but what about instead of:

  (#?(:clj isRealized
      :cljs -realized?)
    [_]
    (boolean (:started (:status (@meta-state name)))))

do

  (#?(:clj isRealized
      :cljs -realized?)
    [_]
    (boolean ((running-states) name)))

running-states returns a set of states that are currently running. I feel it'd be a bit cleaner than to use @meta-state directly.

grammati commented 7 years ago

Thanks, that looks nicer. I pushed an update to use running-states.

tolitius commented 7 years ago

looks good, thank you!