Hi,

Am 19.08.2011 um 05:00 schrieb Timothy Baldridge:

> I'm trying to track down some reflection warnings in my code.
> 
> There is one that I can't track down, however.
> 
> Example:
> 
> (def ID 4)
> 
> (defn output [itm ^java.io.DataOutputStream stream]
>         (.write stream ID)
>         (.writeInt itm))
> 
> Reflection warning, NO_SOURCE_PATH:4061 - call to write can't be resolved.
> 
> ---
> 
> This however, works just fine:
> 
> (defn output [itm ^java.io.DataOutputStream stream]
>         (.writeInt stream ID)
>         (.writeInt itm))
> 
> Why can the compile resolve .writeInt, but not write?

My suspicion is because there is only one writeInt. So there is no ambiguous 
choice. However there are two writes: write(int) and write(byte[]). So Clojure 
can't decide. If you hint ID to be an int, the warning will probably go away, 
no?

Sincerely
Meikel

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

Reply via email to