Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add deprecation notices for -?> and -?>>

  • Loading branch information...
commit b7622bfa47adad9916c7ca7caad66ce2b76ff31c 1 parent 28110f5
@cemerick cemerick authored
Showing with 17 additions and 7 deletions.
  1. +6 −2 README.md
  2. +11 −5 src/main/clojure/clojure/core/incubator.clj
View
8 README.md
@@ -2,13 +2,17 @@
Future home of fns proposed for core inclusion. Currently:
-* A set of short-circuiting "nil-safe" threading macros (e.g. `-?>`, `-?>>` and
- `.?.`)
+* A "nil-safe" threading macro for interop forms (`.?.`)
* An implementation of `dissoc-in`
* An implementation of `seqable?`
* A string interpolation macro (`<<`), originally described
[here](http://cemerick.com/2009/12/04/string-interpolation-in-clojure/).
+NOTE: If you are looking for the other nil-safe threading macros — `-?>` and
+`-?>>` — they're still here, but deprecated; they were effectively promoted into
+`clojure.core` starting with Clojure 1.5 in the form of `some->` and `some->>`,
+respectively.
+
For more details, please see the project's [generated API
documentation](http://clojure.github.com/core.incubator/).
View
16 src/main/clojure/clojure/core/incubator.clj
@@ -27,12 +27,15 @@
`(~'~nil-safe-name (~'~nil-safe-name ~x# ~form#) ~@more#))))
(defnilsafe
- "Same as clojure.core/-> but returns nil as soon as the threaded value is nil itself (thus short-circuiting any pending computation).
+ "DEPRECATED: use clojure.core/some-> instead.
+
+ Same as clojure.core/-> but returns nil as soon as the threaded value is nil itself (thus short-circuiting any pending computation).
Examples :
(-?> \"foo\" .toUpperCase (.substring 1)) returns \"OO\"
(-?> nil .toUpperCase (.substring 1)) returns nil
"
- -> -?>)
+ ->
+ ^{:deprecated "0.1.3"} -?>)
(defnilsafe
"Same as clojure.core/.. but returns nil as soon as the threaded value is nil itself (thus short-circuiting any pending computation).
@@ -43,12 +46,15 @@
.. .?.)
(defnilsafe
- "Same as clojure.core/->> but returns nil as soon as the threaded value is nil itself (thus short-circuiting any pending computation).
+ "DEPRECATED: use clojure.core/some->> instead.
+
+ Same as clojure.core/->> but returns nil as soon as the threaded value is nil itself (thus short-circuiting any pending computation).
Examples :
(-?>> (range 5) (map inc)) returns (1 2 3 4 5)
(-?>> [] seq (map inc)) returns nil
"
- ->> -?>>)
+ ->>
+ ^{:deprecated "0.1.3"} -?>>)
;; ----------------------------------------------------------------------
;; scgilardi at gmail
@@ -83,4 +89,4 @@
(instance? Iterable x)
(-> x .getClass .isArray)
(string? x)
- (instance? java.util.Map x)))
+ (instance? java.util.Map x)))
Please sign in to comment.
Something went wrong with that request. Please try again.