On Wednesday, May 7, 2014 1:00:01 PM UTC-5, squeegee wrote:
>
>
> On May 7, 2014, at 12:11 PM, Mars0i <mars...@logical.net <javascript:>> 
> wrote:
>
> To me, the fact that BigDecimal is contagious sometimes but not always, 
> seems confusing in a way that could encourage bugs.  The fact that BigInts 
> are contagious would also lead one to assume that BigDecimals are 
> contagious.
>
>
> I don’t think it's a case of “sometimes but not always”. Instead there’s a 
> contagion precedence order such that any type earlier in the order combined 
> with a type later in the order yields the type later in the order.
>
> Here’s the order: Long < BigInt < Ratio < BigDec < Double
>
> Before applying the contagion order, narrower integer types are promoted 
> to Long, and float is promoted to Double.
>
>
Thanks Steve.  That's very clear, and very helpful.  It's no longer 
confusing to me.  I still would say that it would be a good thing if 
precedence order were documented explicitly at clojure.org or another 
obvious documentation source.  There's still some potential for confusion.  
The rule is not what I would have expected.
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to