Uploaded image for project: 'Clojure'
  1. CLJ-706

make use of deprecated namespaces/vars easier to spot

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects versions: None
    • Fix versions: None
    • Labels:
    • Approval:
      Prescreened
    • Patch:
      Code and Test

      Description

      From the mailing list http://groups.google.com/group/clojure/msg/c41d909bd58e4534. 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.

      Proposed:

      • 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

      Examples:

      (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?

        Attachments

          Activity

            People

            • Assignee:
              cezarykosko Cezary Kosko
              Reporter:
              stu Stuart Halloway
            • Votes:
              16 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: