Skip to content

Commit fd5e731

Browse files
committed
[Fix #181] Document the :deprecated metadata
1 parent 75d1686 commit fd5e731

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

README.adoc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,6 +1893,35 @@ composability.
18931893

18941894
Prefer syntax-quoted forms over building lists manually.
18951895

1896+
== Common Metadata
1897+
1898+
In this section we'll go over some common metadata for namespaces and
1899+
vars that Clojure development tools can leverage.
1900+
1901+
=== `:deprecated`
1902+
1903+
The most common way to mark deprecated public APIs is via the `:deprecated`
1904+
metadata. Normally you'd use as the value the version in which something
1905+
was deprecated in case of versioned software (e.g. a library) or simply
1906+
`true` in the case of unversioned software (e.g. some web application).
1907+
1908+
[source,clojure]
1909+
----
1910+
(def ^{:deprecated "0.5"} foo
1911+
"Use `bar` instead.
1912+
42)
1913+
1914+
(ns foo.bar
1915+
"A deprecated ns."
1916+
{:deprecated "0.8"})
1917+
1918+
(defn ^{:deprecated "0.5"} foo
1919+
(bar))
1920+
----
1921+
1922+
TIP: If you're into SemVer, it's a good idea to omit the patch version.
1923+
This means you should use `0.5` instead of `0.5.0`.
1924+
18961925
== Comments
18971926

18981927
[quote, Steve McConnell]

0 commit comments

Comments
 (0)