Hey all,

I recently started upgrading Storm to Clojure 1.3, and I ran into
various issues due to Clojure's treatment of integers and longs. In
particular, I have a situation like the following:

1. A Java object returns me an int. Let's call this value "v".
2. I put "v" into a map, and pass that map into a Java object
3. I get ClassCastExceptions when that Java object tries to read that
Integer and instead gets a Long back

The error arises due to Clojure's auto-coercion of primitive ints to
longs.

Auto-coercing ints to longs is prone to errors like I ran into,
especially when interoperating with Java code. It becomes especially
confusing when considering that "Integer" objects do not get coerced
to "Long" objects. Also, if Clojure is trying to treat everything as
longs, I don't understand why there's an unchecked-divide-int function
and not an unchecked-divide-long function.

What's the rationale behind all this? Why not support both ints and
longs? I'm sure this has been discussed before, so feel free to point
me to earlier discussions on this.

-Nathan

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