It would seem that a solution to this problem would be to treat such
automatic boxing/upcasting similar to reflection -- i.e., have an
option that causes Clojure to spit out a warning when such boxing/
upcasting occurs, alerting the performance conscious of the need to
change the code that is generating the offense.


On Nov 2, 9:26 pm, CuppoJava <patrickli_2...@hotmail.com> wrote:
> Personally, I find the added time and complexity required to be
> careful about such problems (ie. numerical overflow) is easier to deal
> with than later having to optimize subtle performance problems that
> arise from these automatic boxing / upcasting solutions. From the
> frequency of performance-related posts on the newsgroup, it seems I'm
> not the only one who finds optimizing Clojure difficult enough as it
> is.
>   -Patrick
>
> On Nov 2, 6:22 pm, box <somethingital...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Math/abs doesn't always return positive numbers. example:
>
> > user=> (def min-int -2147483648)
> > #'user/min-int
>
> > user=> min-int
> > -2147483648
>
> > user=> (Math/abs min-int)
> > -2147483648
>
> > user=> (def min-int+1 (+ 1 min-int))
> > #'user/min-int+1
>
> > user=> min-int+1
> > -2147483647
>
> > user=> (Math/abs (- min-int+1 1))
> > -2147483648
>
> > (Math/abs (- Integer/MIN_VALUE 1))
> > 2147483649
>
> > so, in order to solve this problem, clojure needs it's own ABS, or it
> > needs to convert a negative int approaching Integer/MIN_VALUE to
> > something else before it reaches Integer/MIN_VALUE.
>
> > so, does it sound sane for clojure to fix java's surprises?

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