Selective receive breaks when spawning an actor on a redefined `defsfn`
Thank you for Pulsar, it looks amazing!
It seems I can't reload suspendable functions in the REPL. Entering this in the REPL works as expected (printing "one"):
(defsfn a1 []
(receive
:ab (println "one")))
(def aa (spawn a1))
(! aa :ab)
However when entering the expressions again (slightly changed) (or alternatively calling (clojure.tools.namespace.repl/refresh)), I won't see a result printed:
(defsfn a1 []
(receive
:ab (println "two")))
(def aa (spawn a1))
(! aa :ab)
I'm using
:dependencies [[org.clojure/clojure "1.8.0"]
[co.paralleluniverse/quasar-core "0.7.5"]
[co.paralleluniverse/pulsar "0.7.5"]
]
:java-agents [[co.paralleluniverse/quasar-core "0.7.5"]]
This might be related to Clojure's 1.8's direct linking. Have you tried with ^:redef or ^:dynamic?
@circlespainter Thank you for the quick response!
I tried reloading
(defsfn ^:redef a1 []
(receive
:ab (println "two")))
and
(defsfn ^:dynamic a1 []
(receive
:ab (println "two")))
in clojure 1.8.0 and 1.7.0, but got the same behaviour as above.
While testing I noticed I can reload this in clojure 1.8.0 and 1.7.0!:
(def b1 (sfn []
(receive
:ab (println "three"))))
This should solve my immediate problem using Pulsar with the Component lib/reloaded workflow. Will test this now..
Just to confirm, as expected (def a (sfn [] ...) works fine with component/reloaded workflow, while (defsfn a [] ..) doesn't.
This doesn't happen with non-matching receives ((receive)).