convention | since v0.0-927 | in clojure | Edit |
A naming convention for dynamic vars (unenforced).
(def ^:dynamic *foo* 1)
Dynamic vars are global vars that you intend to temporarily rebind with
binding
.
NOTE: Sometimes, the core library uses the earmuffs convention for non-dynamic
special global vars (e.g. *clojurescript-version*
,
*main-cli-fn*
).
(def ^:dynamic *foo* 1)
(defn print-foo []
(println *foo*))
(print-foo)
;; 1
(binding [*foo* 2]
(print-foo))
;; 2
(print-foo)
;; 1