This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; TBD: What is going on here? | |
;; Why does (Math/abs (f2 -3)) cause a | |
;; reflection warning, but neither of the other variants does? | |
user=> (clojure-version) | |
"1.6.0" | |
user=> (set! *warn-on-reflection* true) | |
true | |
user=> (defn ^{:tag 'long} f1 [x] (inc x)) | |
#'user/f1 | |
user=> (Math/abs (f1 -3)) | |
2 | |
user=> (defn ^{:tag 'long} f2 [^long x] (inc x)) | |
#'user/f2 | |
user=> (Math/abs (f2 -3)) | |
Reflection warning, NO_SOURCE_PATH:6:1 - call to static method abs on java.lang.Math can't be resolved (argument types: java.lang.Object). | |
2 | |
user=> (defn ^{:tag 'long} f3 ^long [^long x] (inc x)) | |
#'user/f3 | |
user=> (Math/abs (f3 -3)) | |
2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment