@@ -1898,6 +1898,45 @@ Prefer syntax-quoted forms over building lists manually.
1898
1898
In this section we'll go over some common metadata for namespaces and
1899
1899
vars that Clojure development tools can leverage.
1900
1900
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
+
1901
1940
=== `:deprecated`
1902
1941
1903
1942
The 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
1936
1975
"DEPRECATED: A deprecated ns.")
1937
1976
----
1938
1977
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
-
1943
1978
=== `:superseded-by`
1944
1979
1945
1980
Often 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.
1973
2008
1974
2009
TIP: You can also consider adding `:supersedes` metadata to the newer APIs, basically the inverse of `:superseded-by`.
1975
2010
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
-
1994
2011
== Comments
1995
2012
1996
2013
[quote, Steve McConnell]
0 commit comments