This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-03
Channels
- # announcements (5)
- # babashka (7)
- # beginners (119)
- # biff (4)
- # cider (7)
- # clj-kondo (26)
- # cljfx (3)
- # cljs-dev (2)
- # clojure (28)
- # clojure-austin (18)
- # clojure-europe (9)
- # clojure-france (6)
- # clojure-norway (4)
- # clojure-uk (3)
- # clojurescript (6)
- # community-development (1)
- # core-async (4)
- # cursive (9)
- # data-science (12)
- # datomic (13)
- # duct (18)
- # emacs (15)
- # etaoin (5)
- # events (13)
- # honeysql (46)
- # hyperfiddle (9)
- # jackdaw (5)
- # jobs (13)
- # keechma (4)
- # lsp (37)
- # malli (32)
- # nbb (14)
- # off-topic (10)
- # other-languages (2)
- # polylith (4)
- # programming-beginners (3)
- # reagent (27)
- # reitit (1)
- # shadow-cljs (32)
- # sql (11)
- # tools-build (5)
- # tools-deps (3)
- # vim (14)
- # xtdb (11)
Think I’ve found a bug in core.async tests, the following test for mult
working seems purely coincidental:
;; ASYNC-127
(let [ch (to-chan! [1 2 3])
m (mult ch)
t-1 (chan)
t-2 (chan)
t-3 (chan)]
(tap m t-1)
(tap m t-2)
(tap m t-3)
(close! t-3)
(is (= 1 (<!! t-1)))
(is (= nil (a/poll! t-1))) ;; t-2 hasn't taken yet
(is (= 1 (<!! t-2)))
(is (= 2 (<!! t-1))) ;; now available
(is (= nil (a/poll! t-1)))))
The docstring of core.async/mult states that: Items received when there are no taps get dropped.
Following this statement, the 3 items put by to-chan! should be dropped, as when the mult is created, it would start consuming them without taps yet on the http://mult.My suspicion is that it passes because the go’s created inside mult
and to-chan!
might be slow enough to create so that the taps get executed before the mult starts consuming.
Does this make sense? Am I missing something?Logged in https://ask.clojure.org/index.php/12100/core-async-mult-test-is-passing-accidentally
possibly. I don't have time to look at it right now, but if you want to put it on https://ask.clojure.org, I will look at it eventually
👍 1