Add warning when derefing a changed wrap

This commit is contained in:
Dan Holmsand 2015-02-01 19:53:00 +01:00
parent 6e0e9ed564
commit 2c7abcb710
1 changed files with 7 additions and 2 deletions

View File

@ -260,7 +260,7 @@
IDeref
(-deref [this]
(if-not (or auto-run *ratom-context*)
(if-not (or auto-run (some? *ratom-context*))
(do
(when dirty?
(let [oldstate state]
@ -321,7 +321,12 @@
IAtom
IDeref
(-deref [this] state)
(-deref [this]
(when (dev?)
(when (and changed (some? *ratom-context*))
(log "warning: derefing stale wrap: "
(pr-str this))))
state)
IReset
(-reset! [this newval]