Re: [lang] Immutable classes (Pair/Range etc)

2011-05-18 Thread Henri Yandell
Logically - makes sense. Make 'em final. Realistically - the finality of String and friends is an immense pain and led us to ugly Utils classes and lots of non-OO style code. I wonder if we can contain your BigDecimal logic in some way. My initial thoughts though end up much like the Cloneable ma

Re: [lang] Immutable classes (Pair/Range etc)

2011-05-18 Thread Matt Benson
On Wed, May 18, 2011 at 12:20 PM, Stephen Colebourne wrote: > On 18 May 2011 18:09, Stephen Colebourne wrote: >> See the EvilFoo example above. Any ability to subclass, even with safe >> methods, means its not completely thread-safe. > > More info: > > StringBuilder evilBuf = new StringBuilder();

Re: [lang] Immutable classes (Pair/Range etc)

2011-05-18 Thread Stephen Colebourne
On 18 May 2011 18:09, Stephen Colebourne wrote: > See the EvilFoo example above. Any ability to subclass, even with safe > methods, means its not completely thread-safe. More info: StringBuilder evilBuf = new StringBuilder(); EvilFoo evilFoo = new EvilFoo(evilBuf); doStuff(evilFoo); // evilFoo

Re: [lang] Immutable classes (Pair/Range etc)

2011-05-18 Thread Stephen Colebourne
On 18 May 2011 17:58, Matt Benson wrote: > On Wed, May 18, 2011 at 11:47 AM, Stephen Colebourne > wrote: >> This issue about what immutable means wrt "final" on the class has >> bounced around a few threads. >> >> In my view, immutable has a specific meaning, whereby the object is >> unequivicall

Re: [lang] Immutable classes (Pair/Range etc)

2011-05-18 Thread Matt Benson
On Wed, May 18, 2011 at 11:47 AM, Stephen Colebourne wrote: > This issue about what immutable means wrt "final" on the class has > bounced around a few threads. > > In my view, immutable has a specific meaning, whereby the object is > unequivically safe to use and share between threads. To do so,

[lang] Immutable classes (Pair/Range etc)

2011-05-18 Thread Stephen Colebourne
This issue about what immutable means wrt "final" on the class has bounced around a few threads. In my view, immutable has a specific meaning, whereby the object is unequivically safe to use and share between threads. To do so, there are certain rules. One that is disputed is whether the class mus