This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: kawa-java string compatibility proposal


On Friday 04 March 2005 00:10, Per Bothner wrote:
> > I think of an immutable string as one that has the same interface
> > as a mutable string but if you try to mutate it you get a runtime
> > exception.
> 
> The other way is compatible with static typing and I believe better
> fits with object-oriented design principles.

Based on the earlier posts in this thread, I believe "the other way"
refers to deriving a mutable class from an immutable one.  If so, I'd
like to register my unsolicited objection.

If followed to their logical conclusion, "object-oriented design
principles" require immutable classes to be final.  Arguments
supporting this position are scattered throughout the following
thread:

   http://people.csail.mit.edu/people/gregs/ll1-discuss-archive-html/threads.html#03905

To back this up with empirical evidence, I submit the following
factoid.  All immutable classes in Java are final.  (And in those rare
cases that they aren't, Sun is on record admitting their boo-boo.)

Granted, I don't have the slightest idea whose approach is better:
yours or Jim White's.  I'm not qualified to argue the specifics.
However, I'm as qualified as the next guy to argue about
"object-oriented design principles" :)

I will now return to my regularly scheduled programming.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]