On 18 Jul 2025, at 10:07, richard <rich...@frithmacdonald.me.uk> wrote: > > I don't know what OSX does, and having methods of a mutable class (other than > -copy...) return immutable instances is unusual/unintuitive, but from a > performance point of view (because character sets can consume a lot of > memory) it makes complete sense for these methods to return shared/singleton > instances of immutable character sets.
If I remember correctly, GNUstep uses an idiom in a few places where there’s a ‘mutable’ subclass that lazily delegates to an immutable singleton until a mutator method is called, at which point it does the lazy copy and swizzles its ISA to the proper mutable version. David