core.match

Bad interaction with core.async

Details

  • Type: Defect Defect
  • Status: Reopened Reopened
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • 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.

Activity

Hide
David Nolen added a comment -

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

Show
David Nolen added a comment - This is not a bug, it's not possible to use <! outside of go blocks.
Hide
Stefan Fehrenbach added a comment -

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)))))
Show
Stefan Fehrenbach added a comment - 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)))))
Hide
David Nolen added a comment - - edited

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.

Show
David Nolen added a comment - - edited 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.
Hide
Stefan Fehrenbach added a comment -

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!

Show
Stefan Fehrenbach added a comment - 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!
Hide
David Nolen added a comment -

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

Show
David Nolen added a comment - Is this still a problem? I think core.async recently added better analysis of the dot form.
Hide
Stefan Fehrenbach added a comment -

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"]

Show
Stefan Fehrenbach added a comment - 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"]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: