core-async 2025-11-26

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.

Alex Miller (Clojure team) 2025-11-26T23:03:27.807239Z

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

Alex Miller (Clojure team) 2025-11-26T23:03:59.289009Z

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

indentation threw me off

(go (letfn [] (<! (timeout 10)))) fails too πŸ™‚

πŸ™ 1

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