Here's what I would suspect after running the following at the REPL

user=> (set! *warn-on-reflection* true)
true
user=> (defn bar [o] (.toString o))
Reflection warning, NO_SOURCE_PATH:605 - reference to field toString
can't be resolved.
#'user/bar
user=> (bar 1)
"1"

How does the reader know the difference between .hashCode
and .reallyObsureMethod?  It would need to keep a whitelist of
everything in object, and know that these methods can be called
directly.  Maybe the reader should be upgraded to handle this?

Could be totally wrong.

Sean

On Feb 24, 2:56 am, Konrad Hinsen <konrad.hin...@fastmail.net> wrote:
> The following trivial code generates a reflection warning for the call  
> to hashCode:
>
> (set! *warn-on-reflection* true)
>
> (defn foo [o]
>    (.hashCode o))
>
> It's easy to fix:
>
> (defn foo [#^Object o]
>    (.hashCode o))
>
> but I don't understand why a type hint for java.lang.Object could ever  
> be necessary. My understanding is (was?) that java.lang.Object is the  
> default type for all function arguments in Clojure. Am I wrong?
>
> Konrad.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to