Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: immutable BigInteger



Mike,

There is a conceptional difference between value and object. Values model abstract entities, they are immutable but can be interpreted in different ways. The abstract value "5" cannot be changed (think of the consequences if this would be possible) and therefore you don't have any side effects when shared; this value can be interpreted as 5, five, V etc. Social security number or account number are futher examples of value types. Objects model phenomena of a domain, can be changed, shared and therefore you get side effects.
In Java, basic types represents values. If you need to implement a value in Java you have to make them immutable in order to meet the conceptual requirements. Apart from avoiding side effects, immutability can be more efficient by having just one instance per value. As far as I know some values of Integer (0 - 100?) are already preallocated and can easily be shared.


Cheers

--Bruno


On 08.10.2007, at 12:41, Michael Hall wrote:

Not OS X specific. But anyhow, I thought the list was supposed to allow more general java development discussion these days.
Does anyone have a good explanation for why BigInteger needs to be immutable? Or know where such a good explanation might be read?
I think sometimes for highly iterative computational code you can get both better memory management and speed if you avoid the immutable inherent in BigInteger.
But there might be something I'm missing as to why this isn't a good idea, so before I put a lot more time into figuring out how to get around BigInteger?


Mike Hall        hallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/bruno.schaeffer% 40canoo.com


This email sent to email@hidden


------------------------------------------------------------------------
Bruno Schaeffer                                    Tel: +41 61 228 94 44
Canoo                                              Fax: +41 61 228 94 49
Kirschgartenstrasse 7
CH-4051 Basel
http://www.canoo.com                           email@hidden

Beyond AJAX - Java Rich Internet Applications   http://www.canoo.com/ulc
------------------------------------------------------------------------



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >immutable BigInteger (From: Michael Hall <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.