From 734e88b20cb740bd9ee9ddfeaae0a8cd7ec1a04e Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Tue, 29 Sep 2015 14:26:54 +0700 Subject: [PATCH] `defonce` on all dynamic vars (allow `alter-var-root`) --- src/taoensso/nippy.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/taoensso/nippy.clj b/src/taoensso/nippy.clj index 9648ac1..dbebf95 100644 --- a/src/taoensso/nippy.clj +++ b/src/taoensso/nippy.clj @@ -335,7 +335,7 @@ (.writeLong out (.getMostSignificantBits x)) (.writeLong out (.getLeastSignificantBits x))) -(def ^:dynamic *final-freeze-fallback* nil) +(encore/defonce* ^:dynamic *final-freeze-fallback* nil) (defn freeze-fallback-as-str [out x] (-freeze-to-out {:nippy/unfreezable (encore/pr-edn x) :type (type x)} out)) @@ -491,7 +491,7 @@ (def ^:private class-method-sig (into-array Class [IPersistentMap])) -(def ^:dynamic *custom-readers* "{ (fn [data-input])}" nil) +(encore/defonce* ^:dynamic *custom-readers* "{ (fn [data-input])}" nil) (defn swap-custom-readers! [f] (alter-var-root #'*custom-readers* f)) (defn- read-custom! [type-id in]