Skip to content

Commit 0098d0e

Browse files
committed
revert *loaded-libs* to ref for binary compatibility
1 parent 9e22e63 commit 0098d0e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/clj/clojure/core.clj

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5361,7 +5361,7 @@
53615361
~@(map process-reference references))
53625362
(if (.equals '~name 'clojure.core)
53635363
nil
5364-
(do (swap! @#'*loaded-libs* conj '~name) nil)))))
5364+
(do (dosync (commute @#'*loaded-libs* conj '~name)) nil)))))
53655365

53665366
(defmacro refer-clojure
53675367
"Same as (refer 'clojure.core <filters>)"
@@ -5382,8 +5382,8 @@
53825382

53835383
(defonce ^:dynamic
53845384
^{:private true
5385-
:doc "An atom around a sorted set of symbols representing loaded libs"}
5386-
*loaded-libs* (atom (sorted-set)))
5385+
:doc "A ref to a sorted set of symbols representing loaded libs"}
5386+
*loaded-libs* (ref (sorted-set)))
53875387

53885388
(defonce ^:dynamic
53895389
^{:private true
@@ -5454,18 +5454,20 @@
54545454
"namespace '%s' not found after loading '%s'"
54555455
lib (root-resource lib))
54565456
(when require
5457-
(swap! *loaded-libs* conj lib)))
5457+
(dosync
5458+
(commute *loaded-libs* conj lib))))
54585459

54595460
(defn- load-all
54605461
"Loads a lib given its name and forces a load of any libs it directly or
54615462
indirectly loads. If need-ns, ensures that the associated namespace
54625463
exists after loading. If require, records the load so any duplicate loads
54635464
can be skipped."
54645465
[lib need-ns require]
5465-
(swap! *loaded-libs* #(reduce1 conj %1 %2)
5466-
(binding [*loaded-libs* (atom (sorted-set))]
5466+
(dosync
5467+
(commute *loaded-libs* #(reduce1 conj %1 %2)
5468+
(binding [*loaded-libs* (ref (sorted-set))]
54675469
(load-one lib need-ns require)
5468-
@*loaded-libs*)))
5470+
@*loaded-libs*))))
54695471

54705472
(defn- load-lib
54715473
"Loads a lib with options"

0 commit comments

Comments
 (0)