Subject: | |
From: | |
Reply To: | |
Date: | Thu, 29 Oct 2009 18:27:29 +0100 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On Oct 29, 2009, at 6:18 PM, glen e. p. ropella wrote:
> The point being, if you want to make the two things adhere to the same
> interface, then why are they different classes? Is it solely for
> efficiency? Are there separate (functional requirement based) use
> cases
> for mutables than for immutables? Etc.
It's always been efficiency.
It's not uncommon either: for example, Obj-C has immutable and mutable
versions of all of its basic data types.
Double2D is obviously the primary though, because its immutability
means it doesn't break Java's hash tables (unlike say, the mutable
java.awt.Point2D).
This is less of an issue with more efficient handling of allocations
of small short-lived objects in Java, which is a priority for Sun now
that all the boxing and unboxing is going on (ugh). But it's still
slower.
My goal then has been to try to make the Mutable classes *reasonably*
compatible with the immutable classes without causing lots of
confusion among people.
Sean
|
|
|