This is a continuation of my previous question on static typing of Clojure.
I looked at the Java source code for the compiler, and there are several places where it checks the value *warn-on-reflection*, but when I compile the following code, I get only an error at runtime:
(defn div-2 [^String s] (/ 2 s))
Are there any circumstances under which this code should not give a compilation warning (this is not the case)? How difficult it would be to give the compiler a warning about the following code:
(defn get-length [^String s] (.length s))
(defn test-get-length [] (get-length 2.0))
Thank.
Ralph source
share