On Sat, Jun 26, 2010 at 05:58, Andrzej <ndrwr...@googlemail.com> wrote: > On Sat, Jun 26, 2010 at 4:04 AM, Rich Hickey <richhic...@gmail.com> wrote: >> equiv, the revenge of num > > Has it already been decided that some sort of this new numeric tower > will find its way into Clojure? > > Personally, I think this change will open a can of worms and make > programming in Clojure more difficult and error prone. > > I don't think there is a nice and clean solution to the numeric > problem (Clojure is not the first language tackling it) but there are > two possibilities that could produce an acceptable trade off: > - using boxed math everywhere and optimizing performance by storing > preallocated Integers in a cache,
This was suggested on the previous thread on this topic as well, but I don't think it was pointed out that *Java already does this*. See the inner class IntegerCache at line 608: http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/3956cdee6712/src/share/classes/java/lang/Integer.java And for Long as well (line 543): http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/3956cdee6712/src/share/classes/java/lang/Long.java > - using both boxed and primitive math but keeping the boundary between > them as explicit as possible (different operators, no automatic > conversion etc.). Existing operators should default to boxed math (for > runtime safety and compatibility). > > Andrzej > > -- > 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 -- 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