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