Skip to content

Instantly share code, notes, and snippets.

@fogus
Last active December 20, 2015 09:09
Show Gist options
  • Save fogus/6106189 to your computer and use it in GitHub Desktop.
Save fogus/6106189 to your computer and use it in GitHub Desktop.
(ns depr.core)
(defn ^:private !! [c]
(println "WARNING - Deprecation of " c " in effect."))
(defmacro defn-deprecated
[nom _ alt ds & arities]
(let [silence? (:silence-deprecations (meta clojure.core/*ns*))]
(when-not silence?
(!! alt)))
`(defn ~nom ~ds ~@arities))
(ns ^:silence-deprecations depr.core-test
(:use clojure.test)
(:require [depr.core :refer (defn-deprecated)]))
(defn-deprecated foo :as quux
"Does something"
[]
42)
(deftest a-test
(testing "Nothing really"
(is (= 42 (foo)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment