make use of deprecated namespaces/vars easier to spot


  • Type: Feature Feature
  • Status: Open Open
  • Priority: Critical Critical
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Approval:


From the mailing list It is easy to use deprecated namespaces or vars without knowing you are doing so. The documentation warnings are small, and there is no compiler warning.


  • Add new *warn-on-deprecated* dynamic var, defaulted to false
  • Warn to stderr when {:deprecated true} namespace is loaded.
  • Warn to stderr when {:deprecated true} var is analyzed.
  • Warn to stderr when {:deprecated true} macro is expanded.
  • New system property clojure.compiler.warn-on-deprecated
  • Compile Clojure itself with clojure.compiler.warn-on-deprecated
  • Fix deprecation warnings inside Clojure (replicate, clear-agent-errors)
  • Mark clojure.parallel as deprecated with :deprecation tag


(set! *warn-on-deprecated* true)

;; use of a deprecated var (on compile)
(defn ^:deprecated f [x] x)
(f 5)
;;=> Deprecation warning, NO_SOURCE_PATH:7:1 : var #'user/f is deprecated

;; use of a deprecated macro (on macro expansion)
(defmacro ^:deprecated m [x] x)
(m 5)
;;=> Deprecation warning, NO_SOURCE_PATH:7:1 : macro #'user/m is deprecated

;; use of a deprecated namespace (on load)
(ns foo {:deprecated "1.1"})
(ns bar (:require foo))
;;=> Deprecation warning: loading deprecated namespace `foo` from namespace `bar`

Patch: 706-deprecated-ns-var-warnings-tested-3.diff

Questions: Should default for deprecation warnings be true instead? People upgrading are likely to see new warnings which might be surprising.

  • Should default be to warn or not warn on deprecated?
  1. 706-deprecated-ns-var-warnings-tested.diff
    07/Mar/16 9:18 PM
    10 kB
    Cezary Kosko
  2. 706-deprecated-ns-var-warnings-tested-2.diff
    11/Mar/16 5:33 AM
    20 kB
    Cezary Kosko
  3. 706-deprecated-ns-var-warnings-tested-3.diff
    11/Mar/16 12:37 PM
    19 kB
    Cezary Kosko
  4. 706-deprecated-var-warning.diff
    26/Oct/12 1:37 PM
    6 kB
    Luke VanderHart
  5. 706-deprecated-var-warning-patch-v2.txt
    13/Feb/13 12:38 AM
    6 kB
    Andy Fingerhut
  6. 706-fix-deprecation-warnings-agents.diff
    26/Oct/12 1:37 PM
    1 kB
    Luke VanderHart
  7. 706-fix-deprecation-warnings-on-replicate.diff
    26/Oct/12 1:37 PM
    3 kB
    Luke VanderHart
  8. 706-fix-deprecation-warning-test-junit.diff
    26/Oct/12 1:37 PM
    3 kB
    Luke VanderHart
  9. 706-warning-on-deprecated-ns.diff
    29/Oct/12 1:02 AM
    0.9 kB
    Ghadi Shayban



Vote (22)
Watch (9)


  • Created: