Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selective receive breaks when spawning an actor on a redefined defsfn #60

Open
andreasthoelke opened this issue Jul 18, 2016 · 4 comments
Assignees
Labels

Comments

@andreasthoelke
Copy link

andreasthoelke commented Jul 18, 2016

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"]]
@circlespainter
Copy link
Member

This might be related to Clojure's 1.8's direct linking. Have you tried with ^:redef or ^:dynamic?

@circlespainter circlespainter self-assigned this Jul 18, 2016
@andreasthoelke
Copy link
Author

andreasthoelke commented Jul 18, 2016

@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..

@andreasthoelke
Copy link
Author

andreasthoelke commented Jul 18, 2016

Just to confirm, as expected (def a (sfn [] ...) works fine with component/reloaded workflow, while (defsfn a [] ..) doesn't.

@circlespainter circlespainter changed the title Reloading defsfn in the REPL Selective receive breaks when spawning an actor on a redefined defsfn Jul 21, 2016
@circlespainter
Copy link
Member

This doesn't happen with non-matching receives ((receive)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants