> Am 22.07.2025 um 00:34 schrieb Riccardo Mottola <riccardo.mott...@libero.it>:
>
> Hi,
>
>
> richard 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.
>>
>
> out of curiosity I checked what apple does on both 10.4 and 10.15
>
> In both cases the result is a NSCFCharacterSet
>
> Interesting is that during Autocompletion, XCode of 10.4 says it will return
> NSCharacterSet* while 10.15 lies and says it will be NSMutableCharacterSet* !
Come on Riccardo, before accusing Apple of lying, you should better check the
facts first. :-)
If you use any of the character set class methods, Xcode says that they return
a NSCharacterSet *, which is what you’d expect. It‘s only when you use them for
NSMutableCharacterSet that Xcode says that they return a NSMutableCharacterSet
*. And that is correct as well, as a quick look at either the online
documentation for class NSMutableCharacterSet or at the header NSCharacterSet.h
in any recent version of the OS would have revealed: Apple simply has chosen to
redeclare (and likely reimplement) all of the class methods In
NSMutableCharacterSet to return a NSMutableCharacterSet.
Wolfgang