Skip to content

Commit b1d6fc0

Browse files
committed
requiring-resolve
1 parent 7c6be3a commit b1d6fc0

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/main/clojure/clojure/core/async.clj

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ IOC and vthread code.
8383
[java.util.concurrent ThreadLocalRandom]
8484
[java.util Arrays ArrayList]))
8585

86-
(when (not dispatch/lazy-loading-supported?)
86+
(def ^:private lazy-loading-supported? (dispatch/at-least-clojure-version? [1 12 3]))
87+
88+
(when (not lazy-loading-supported?)
8789
(require 'clojure.core.async.impl.go))
8890

8991
(alias 'core 'clojure.core)
@@ -514,11 +516,6 @@ IOC and vthread code.
514516
(let [ret (impl/take! port (fn-handler nop false))]
515517
(when ret @ret)))
516518

517-
(defn- dynamic-require [nsym]
518-
(when (and dispatch/lazy-loading-supported?
519-
(not (contains? @@#'clojure.core/*loaded-libs* nsym)))
520-
(#'clojure.core/serialized-require nsym)))
521-
522519
(defn- go* [body env]
523520
(cond (and (not dispatch/virtual-threads-available?)
524521
dispatch/target-vthreads?
@@ -533,8 +530,7 @@ IOC and vthread code.
533530
(thread-call (^:once fn* [] ~@body) :io))
534531

535532
:else
536-
(do (dynamic-require 'clojure.core.async.impl.go)
537-
((find-var 'clojure.core.async.impl.go/go-impl) env body))))
533+
((requiring-resolve 'clojure.core.async.impl.go/go-impl) env body)))
538534

539535
(defmacro go
540536
"Asynchronously executes the body, returning immediately to the

src/main/clojure/clojure/core/async/impl/dispatch.clj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@
7777
(let [{:keys [major minor incremental]} *clojure-version*]
7878
(not (neg? (compare [major minor incremental] [maj min incr])))))
7979

80-
(def lazy-loading-supported? (at-least-clojure-version? [1 12 3]))
81-
8280
(def virtual-threads-available?
8381
(try
8482
(Class/forName "java.lang.Thread$Builder$OfVirtual")

0 commit comments

Comments
 (0)