gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnustep-cvs] Fix NSCharacterSet caching bug


From: David Ayers
Subject: Re: [Gnustep-cvs] Fix NSCharacterSet caching bug
Date: Sat, 01 Nov 2003 11:52:05 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007

Richard Frith-Macdonald wrote:


On Saturday, November 1, 2003, at 10:25 AM, David Ayers wrote:

So in that sense, your change didn't alter the behavior.


Your change turned off caching ... since the test [self isSubclassOfClass: [NSCharacterSet class]]
would always be true.

Indeed it did :-/ !!
I just had to reread the docs, and it is the documented behavior +isSubclassOfClass: to return YES even it the class is identical, (the method name is very misleading).
Sorry about that.

My code turns the caching back on for two cases ... where the class to which the message is
sent is either NSCharacterSet or NSBitmapCharacterSet

My comment was intended to say that, if the message is sent to the class MyCharacterSet (where MyCharacterSet is a custom subclass of NSCharacterSet (but not of NSMutableCharacterSet)), presumably we would like to cache instances of MyCharacterSet and return the cached versions rather than creating a new instance each time. Is it worth building that caching into the abstract NSCharacterSet code, or should MyCharacterSet override the methods to implement caching itsself. I think probably the latter.

Yes, as we know nothing about whether a custom subclass is mutable or not (or maintains other states), it should be it's responsibility to cache when applicable.

Thanks,
David







reply via email to

[Prev in Thread] Current Thread [Next in Thread]