[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: the benefits of immutability

On Tuesday, August 19, 2003, at 10:59  AM, Perry E. Metzger wrote:
> Vadim Nasardinov <el-vadimo@comcast.net> writes:
>> Perry E. Metzger wrote:
>>> Then we should abandon object oriented programming.
>> Perhaps, we should.  I fail to see though how this follows from the
>> previous discussion though.
> Frankly, I don't see how anything follows from your comments. I made a
> point that it was annoying that String couldn't be subclassed, first
> you claimed (bizarrely) that this was so that String could be
> immutable (which of course the final StringBuffer type disproves), and
> then you claimed, bizarrely, that wanting to subclass things is a bad
> idea so I shouldn't claim this as a problem. I noted that Java depends
> on subclassing and now you are weaseling again.

StringBuffer being final disproves nothing. String is final to ensure 
it is immutable. I don't know why StringBuffer is final. There are many 
reasons for something being final. Perhaps security reasons, perhaps 
Sun just screwed up, perhaps a (lame) quest for efficiency. I don't 
know, but it certainly doesn't affect the discussion about String.