@@ -1898,6 +1898,45 @@ Prefer syntax-quoted forms over building lists manually.
18981898In this section we'll go over some common metadata for namespaces and
18991899vars that Clojure development tools can leverage.
19001900
1901+ === `:added`
1902+
1903+ The most common way to document when a public API was added to a
1904+ library is via the `:added` metadata.
1905+
1906+ [source,clojure]
1907+ ----
1908+ (def ^{:added "0.5"} foo
1909+ 42)
1910+
1911+ (ns foo.bar
1912+ "A very useful ns."
1913+ {:added "0.8"})
1914+
1915+ (defn ^{:added "0.5"} foo
1916+ (bar))
1917+ ----
1918+
1919+ TIP: If you're into SemVer, it's a good idea to omit the patch version.
1920+ This means you should use `0.5` instead of `0.5.0`. This applies
1921+ for all metadata data that's version related.
1922+
1923+ === `:changed`
1924+
1925+ The most common way to document when a public API was changed in a
1926+ library is via the `:changed` metadata. This metadata makes sense only for
1927+ vars and you should be using it sparingly, as changing the behavior of
1928+ a public API is generally a bad idea.
1929+
1930+ Still, if you decide to do it, it's best to make that clear to the API
1931+ users.
1932+
1933+ [source,clojure]
1934+ ----
1935+ (def ^{:added "0.5"
1936+ :changed "0.6"} foo
1937+ 43)
1938+ ----
1939+
19011940=== `:deprecated`
19021941
19031942The most common way to mark deprecated public APIs is via the `:deprecated`
@@ -1936,10 +1975,6 @@ was deprecated in case of versioned software (e.g. a library) or simply
19361975 "DEPRECATED: A deprecated ns.")
19371976----
19381977
1939- TIP: If you're into SemVer, it's a good idea to omit the patch version.
1940- This means you should use `0.5` instead of `0.5.0`. This applies
1941- for all metadata data that's version related.
1942-
19431978=== `:superseded-by`
19441979
19451980Often you'd combine `:deprecated` with `:superseded-by`, as there would be
@@ -1973,24 +2008,6 @@ in the same namespace, and a fully-qualified name otherwise.
19732008
19742009TIP: You can also consider adding `:supersedes` metadata to the newer APIs, basically the inverse of `:superseded-by`.
19752010
1976- === `:added`
1977-
1978- The most common way to document when a public API was added to a
1979- library is via the `:added` metadata.
1980-
1981- [source,clojure]
1982- ----
1983- (def ^{:added "0.5"} foo
1984- 42)
1985-
1986- (ns foo.bar
1987- "A very useful ns."
1988- {:added "0.8"})
1989-
1990- (defn ^{:added "0.5"} foo
1991- (bar))
1992- ----
1993-
19942011== Comments
19952012
19962013[quote, Steve McConnell]
0 commit comments