Reinier Zwitserloot wrote: > Wait, what? > > String being final was a mistake? > > Was that a troll? > I don't troll, it's a waste of time! > If string wasn't final, then string isn't immutable, don't confuse variables with class declarations. > and everytime you > pass strings around, you'd need to make a defense copy. Java as a > whole would be utterly unusable. > nonsense, think about the implications of final on a class declaration and then think about the consequences and what you've just wrote. I've read you long enough to know that once you really think about it.... try an string implementation that isn't final and think about the ways you could usefully extend it and have those implementations automatically accept the subclass. UTF is but one small example.
Regards, Kirk > On Feb 22, 8:59 am, kirk <[email protected]> wrote: > >> [email protected] wrote: >> >>> On Feb 17, 6:15 am, Alexander Snaps <[email protected]> wrote: >>> >>>> On Sun, Feb 15, 2009 at 7:13 PM, Reinier Zwitserloot >>>> <[email protected]>wrote: >>>> >>>>> I mark any immutable class final, because if it isn't, then you can't >>>>> rely on its immutability (any subclass is assignment compatible and is >>>>> not neccessarily immutable!). >>>>> >>>> While I tend to agree with marking "type" classes as final, I don't believe >>>> that a class being immutable is reason enough to mark it final. >>>> >>> If it's not final, it probably isn't immutable. Take java.io.File. >>> Please. >>> >> Marking a class as final is a whole different ball game than marking a >> variable as final. For example, marking String as final was a HUGE >> mistake IMHO. It prevented people from making some very useful >> extensions. It's also responsible for a lot of code bloat. I'm not >> against making a class final. That said, to do so because of the need to >> mother other developers shouldn't be one of them. >> >> Kirk >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
