> Thanks. I read through that and it didn't quite answer my question. To
> me it seems more logical that:
> 
> 1. Clojure defaults to longs when you create a new number (with a
> literal 0, 1, etc)
> 2. You can create ints by doing (int 0)
> 3. Clojure never changes the types of things you're using
> 
> I find Clojure's behavior of changing the types of primitive ints to
> longs highly unusual, and it is causing a lot of pain in upgrading
> Storm to 1.3.

Integers and longs are going to be painful no matter what because they are 
broken in Java, e.g.

        Object[] objects = new Object[] {-1, -1L};
        System.out.println(objects[0].hashCode());
        System.out.println(objects[1].hashCode());

Clojure avoids this pit by standardizing on longs, which leaves you with the 
need to specifically request ints when you need them for interop. You can use 
(int n) hints to select the correct interop method invocation, or box an int if 
you want to hold on to a value guaranteed to be int.

Can you post a code example that shows a problem you are having?

Stu


Stuart Halloway
Clojure/core
http://clojure.com

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