This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-30
Channels
- # announcements (40)
- # babashka (41)
- # beginners (32)
- # calva (15)
- # clara (8)
- # clj-kondo (14)
- # cljs-dev (30)
- # clojure (37)
- # clojure-dev (8)
- # clojure-europe (21)
- # clojure-norway (21)
- # clojure-uk (4)
- # clojured (3)
- # clojurescript (4)
- # community-development (10)
- # core-async (13)
- # cursive (23)
- # datomic (15)
- # emacs (9)
- # fulcro (3)
- # google-cloud (4)
- # graphql (24)
- # gratitude (2)
- # holy-lambda (4)
- # honeysql (5)
- # hyperfiddle (9)
- # keechma (1)
- # klipse (5)
- # lsp (23)
- # malli (4)
- # missionary (32)
- # pathom (28)
- # re-frame (2)
- # reagent (40)
- # reitit (17)
- # releases (2)
- # remote-jobs (1)
- # shadow-cljs (25)
- # specter (3)
- # vim (19)
- # xtdb (41)
I'm having a wired behavior in core.async:
(...
(let [send-ch (async/chan)]
(async/thread
(log/info :send-ch send-ch)
(if-let [out-msg (and (some-> send-ch
async/<!!))]
...
(recur)))))
;=> [async-thread-macro-1] INFO - {:send-ch #object[clojure.core.async.impl.channels.ManyToManyChannel ...], :line 73}
;=> [async-thread-macro-1] INFO - {:send-ch nil, :line 73}
Initially, send-ch
has a value: the async/chan
instance
But after a loop/recur, send-ch
tunrs into nil
I didn't even know this was possible in clojure.org.clojure/core.async {:mvn/version "1.5.648"}
I can't reproduce it in a simple scenario 😞
> recur goes back to async/thread I don't think that's true
-------------------------
recur
(recur exprs*)
Special Form
Evaluates the exprs in order, then, in parallel, rebinds
the bindings of the recursion point to the values of the exprs.
Execution then jumps back to the recursion point, a loop or fn method.
Please see
seems that we can't recur to funcions defined with
^:once
(async/thread creates a ^:once
function)
I think relying on a macro you didn't write to wrap your code in a function is probably relying too much on implementation details