Re: Unable to pass unboxed primitive to methods taking multiple numeric primitive types.
On Wed, May 23, 2012 at 7:58 PM, Cedric Greevey cgree...@gmail.com wrote: (defn f [^java.awt.image.BufferedImage bi x] (.setSample (.getRaster bi) 0 0 0 (double x))) #CompilerException java.lang.IllegalArgumentException: More than one matching method found: setSample, compiling:(NO_SOURCE_PATH:1) The only way I was able to find to fix this is (defn f [^java.awt.image.BufferedImage bi] (.setSample (.getRaster bi) 0 0 0 ^Double (double x))) I'm entirely not sure what's going on, but this seems to be good in the repl: (defn f [^java.awt.image.BufferedImage bi x] (.setSample (.getRaster bi) (int 0) (int 0) (int 0) ^double x)) I tried creating an object and running it through the function as well with no warnings. -- 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
Re: Unable to pass unboxed primitive to methods taking multiple numeric primitive types.
Didn't you see that I pasted my sample from the repl? Here it goes again; pay attention: Last login: Thu May 24 07:21:38 on console ~ $ clj Clojure 1.4.0 user= (defn f [^java.awt.image.BufferedImage bi x] (.setData (.getRaster bi) 0 0 0 ^double x)) #'user/f user= ~ $ On Wednesday, May 23, 2012 10:53:15 PM UTC-7, Cedric Greevey wrote: On Wed, May 23, 2012 at 10:21 PM, Armando Blancas abm221...@gmail.com wrote: Is this any better? user= (defn f [^java.awt.image.BufferedImage bi x] (.setData (.getRaster bi) 0 0 0 ^double x)) #'user/f Didn't have a repl handy? It's quick to check that it produces: Reflection warning, NO_SOURCE_PATH:2 - call to setData can't be resolved. -- 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
Re: Unable to pass unboxed primitive to methods taking multiple numeric primitive types.
On Thu, May 24, 2012 at 6:16 AM, John Szakmeister j...@szakmeister.net wrote: On Wed, May 23, 2012 at 7:58 PM, Cedric Greevey cgree...@gmail.com wrote: (defn f [^java.awt.image.BufferedImage bi x] (.setSample (.getRaster bi) 0 0 0 (double x))) #CompilerException java.lang.IllegalArgumentException: More than one matching method found: setSample, compiling:(NO_SOURCE_PATH:1) The only way I was able to find to fix this is (defn f [^java.awt.image.BufferedImage bi] (.setSample (.getRaster bi) 0 0 0 ^Double (double x))) I'm entirely not sure what's going on, but this seems to be good in the repl: (defn f [^java.awt.image.BufferedImage bi x] (.setSample (.getRaster bi) (int 0) (int 0) (int 0) ^double x)) I tried creating an object and running it through the function as well with no warnings. I don't get it. The setSample methods aren't disambiguated by the types of the coordinate arguments -- there's just int int int int, int int int float, and int int int double overloads, so the exact right one should be inferrable if the final argument is known to be a double (and the WritableRaster itself is hinted). It being a primitive local double really ought to suffice, and certainly specifying that the middle arguments are ints shouldn't logically have any effect. Well, except to add a bit of overhead with three additional calls to RT.intCast that really ought to be avoidable. -- 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
Re: Unable to pass unboxed primitive to methods taking multiple numeric primitive types.
On Thu, May 24, 2012 at 10:34 AM, Armando Blancas abm221...@gmail.com wrote: Didn't you see that I pasted my sample from the repl? I saw that you wrote it in the style of a repl interaction, which could have been pasted or could have been synthesized by hand. Given that in the former case it should have been easy for you to see if it avoided any reflection warnings first before posting it, I naturally supposed the latter. Here it goes again; pay attention: How rude. -- 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
Re: Unable to pass unboxed primitive to methods taking multiple numeric primitive types.
I saw that you wrote it in the style of a repl interaction, which could have been pasted or could have been synthesized by hand. Aw! Dude, I'd never bullshit you like that. Honest. But I was sloppy and rude; sorry. -- 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
Unable to pass unboxed primitive to methods taking multiple numeric primitive types.
(defn f [^java.awt.image.BufferedImage bi x] (.setSample (.getRaster bi) 0 0 0 (double x))) #CompilerException java.lang.IllegalArgumentException: More than one matching method found: setSample, compiling:(NO_SOURCE_PATH:1) The only way I was able to find to fix this is (defn f [^java.awt.image.BufferedImage bi] (.setSample (.getRaster bi) 0 0 0 ^Double (double x))) which presumably forces x to be boxed and unboxed again. -- 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
Re: Unable to pass unboxed primitive to methods taking multiple numeric primitive types.
On Wed, May 23, 2012 at 10:21 PM, Armando Blancas abm221...@gmail.com wrote: Is this any better? user= (defn f [^java.awt.image.BufferedImage bi x] (.setData (.getRaster bi) 0 0 0 ^double x)) #'user/f Didn't have a repl handy? It's quick to check that it produces: Reflection warning, NO_SOURCE_PATH:2 - call to setData can't be resolved. -- 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