rcf
rcf copied to clipboard
Sequential rewriting broken in cljs
Cljs macroexpansion needs to sequence test steps using a continuation passing style (we cannot block on a js runtime)
Current rewriting does not sequence steps correctly, the problem is exhibited by rcf/with
.
Workaround:
(defmacro with
"Resource cleanup helper, based on missionary's dependency-free Task protocol, see https://github.com/leonoel/task"
[dispose-fn & body]
`(let [dispose# ~dispose-fn
#_#_res# (do ~@body)] ; busted, introduces second rewrite pass - see https://github.com/hyperfiddle/rcf/issues/56
~@body
(dispose#) ; workaround - due to async dependency on body, must be in same RCF rewrite pass
#_res#))