<< Back to previous view

[MATCH-87] Bad interaction with core.async Created: 11/Sep/13  Updated: 01/Dec/13

Status: Reopened
Project: core.match
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Stefan Fehrenbach Assignee: David Nolen
Resolution: Unresolved Votes: 0
Labels: bug
Environment:

[org.clojure/core.async "0.1.0-SNAPSHOT"] (more specifically core.async-0.1.0-20130827.050117-78)
[org.clojure/core.match "0.2.0-rc5"]



 Description   

This prints "foo" as expected:

(defn works []
  (.log js/console
        (match ["qux" "foo"]
          ["qux" "bar"] 1
          ["qux" x]     x)))

This fails with an exception: Uncaught Error: No matching clause: ["qux" "foo"]
in up-to-date Chromium

(defn fails []
  (go
   (.log js/console
         (match (<! (go ["qux" "foo"]))
           ["qux" "bar"] 1
           ["qux" x]     x))))

I don't know either core.async nor core.match very well. My best guess is a undesired interaction between the nonlocal control flow for backtracking and the core.async state machine.

Note that this is a version of core.async where http://dev.clojure.org/jira/browse/ASYNC-15 is fixed.



 Comments   
Comment by David Nolen [ 11/Sep/13 12:24 PM ]

This is not a bug, it's not possible to use <! outside of go blocks.

Comment by Stefan Fehrenbach [ 11/Sep/13 12:48 PM ]

Does that count as outside? Anyway, this should not be outside. Same problem.

(defn fails []
  (go (let [m (<! (go ["qux" "foo"]))]
        (.log js/console
              (match m
                ["qux" "bar"] 1
                ["qux" x] x)))))
Comment by David Nolen [ 11/Sep/13 1:17 PM ]

Sorry missed the surrounding go! However note tickets about interaction between core.match and core.async are extremely low priority without more information about whether the bug is actually in ASYNC or in MATCH. I just don't have the bandwidth to do that sort of investigation at the moment.

Still, thanks for the report.

Comment by Stefan Fehrenbach [ 11/Sep/13 2:05 PM ]

I see. I'm not so sure whether I should report this to ASYNC, any thoughts?
I'm not familiar with either library, but I'll try to investigate further when I have the time.
For now, I guess I'll do more stupid matching. It really is a shame, core.match is a perfect fit for dispatching on messages and channels coming from alts!. Anyways, thanks for your work!

Comment by David Nolen [ 30/Nov/13 2:28 PM ]

Is this still a problem? I think core.async recently added better analysis of the dot form.

Comment by Stefan Fehrenbach [ 01/Dec/13 2:45 AM ]

Hi, thanks for thinking about this. I got side tracked and did not look into it any further.
Unfortunately it still does not work.

Tested versions:
[org.clojure/clojurescript "0.0-2080"]
[org.clojure/core.async "0.1.242.0-44b1e3-alpha"]
[org.clojure/core.match "0.2.0"]

Generated at Sat Apr 19 09:34:42 CDT 2014 using JIRA 4.4#649-r158309.