On Fri, Jan 9, 2009 at 9:49 PM, CuppoJava <patrickli_2...@hotmail.com> wrote:
>
> After more experimenting, it seems like a potentially difficult bug to
> resolve. Clojure attempts to treat all numbers as objects, but in this
> case, the choice of whether a number is an object or a primitive
> affects which method is called.

A type hint on the 'def' can work around the problem:

user=> (def #^java.util.ArrayList temp (java.util.ArrayList. ["foo"]))
#'user/temp
user=> (.remove temp (int 0))
"foo"

There's a new 'defhinted' in clojure.contrib.def that would do the
type hint for you.

--Chouser

--~--~---------~--~----~------------~-------~--~----~
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
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