Re: Initing sublacss with superclass method
Wolfgang Lux <[email protected]> Tue, 22 Jul 2025 12:08:12 +0200
| Newsgroups | gmane.comp.lib.gnustep.devel |
|---|---|
| Message-ID | <[email protected]> |
> Am 22.07.2025 um 00:34 schrieb Riccardo Mottola <[email protected]= t>: >=20 > =EF=BB=BFHi, >=20 >=20 > richard wrote: >> I don't know what OSX does, and having methods of a mutable class (other t= han -copy...) return immutable instances is unusual/unintuitive, but from a p= erformance point of view (because character sets can consume a lot of memory= ) it makes complete sense for these methods to return shared/singleton insta= nces of immutable character sets. >>=20 >=20 > out of curiosity I checked what apple does on both 10.4 and 10.15 >=20 > In both cases the result is a NSCFCharacterSet >=20 > Interesting is that during Autocompletion, XCode of 10.4 says it will retu= rn NSCharacterSet* while 10.15 lies and says it will be NSMutableCharacterSe= t* ! Come on Riccardo, before accusing Apple of lying, you should better check th= e facts first. :-) If you use any of the character set class methods, Xcode says that they retu= rn a NSCharacterSet *, which is what you=E2=80=99d expect. It=E2=80=98s only= when you use them for NSMutableCharacterSet that Xcode says that they retur= n a NSMutableCharacterSet *. And that is correct as well, as a quick look at= either the online documentation for class NSMutableCharacterSet or at the h= eader NSCharacterSet.h in any recent version of the OS would have revealed: A= pple simply has chosen to redeclare (and likely reimplement) all of the clas= s methods In NSMutableCharacterSet to return a NSMutableCharacterSet. Wolfgang=