Is this a bug?
(go (letfn [(foo [])]
(
Assert failed: the fns inside letfn are new fn scopes, and go only rewrites the immediate fn scope
...so it's fairly accurate
maybe I donβt know how letfn works, but is not inside a function, right?
Sure looks like a bug to me
Which version of core.async @shaunlebron?
> clj
Clojure 1.12.3
user=> (add-lib 'org.clojure/core.async)
[org.clojure/core.async org.clojure/core.cache org.clojure/core.memoize org.clojure/data.priority-map org.clojure/tools.analyzer org.clojure/tools.analyzer.jvm org.clojure/tools.reader org.ow2.asm/asm]
user=> (require '[clojure.core.async :refer [go <! timeout]])
nil
user=> (go (letfn [(foo [])] (<! (timeout 10))))
#object[clojure.core.async.impl.channels.ManyToManyChannel 0xae73c80 "clojure.core.async.impl.channels.ManyToManyChannel@ae73c80"]
How did you get that error exactly?[org.clojure/clojure "1.12.1"]
[org.clojure/core.async "1.8.741"]I can repro with 1.8.741 but not with the most recent version.
I was running it from my repl, in my giant lein project
Looks like maybe missing handling of the :letfn* tools.analyzer ast node
1.9.808-alpha1 shows that error but 1.9.829-alpha2 doesn't, for me.
if you're using the latest alpha on a new jvm, then you're running go in a virtual thread, which is not using the go analyzer
I'm pretty sure there is a jira for letfn in go
Ah, I'd forgotten that...
letfn bindings are new fn contexts, go cannot rewrite through
The op is in the body of the letfn
Not one of fns
oh I misread
indentation threw me off
(go (letfn [] (<! (timeout 10)))) fails too π
Gobsmacked not to have run into this permutation before
From 2018!!!
nobody uses letfn lol
I only started using it recently to reduce the indentation of nested functions, works really well for that
https://github.com/hiredman/clojure/blob/readerIII/src/clj/clojure/reader.clj#L165 letfn and I go back like spinal cords and car seats