Re: [self class] broken for clusters?
Re: [self class] broken for clusters?
- Subject: Re: [self class] broken for clusters?
- From: Kirk Kerekes <email@hidden>
- Date: Fri, 16 Sep 2005 16:14:11 -0500
For those who don't want to wade through my prior post on this topic,
here is an "executive summary":
It appears that there are several Cocoa class-clusters which
return private classes
that do not reliably respond to the -class method with a fully
functional class-object.
As a result, [[someObject class] doAClassMethod] may fail with
an inappropriate exception.
This has only been tested with 10.4.2 and the most recent XCode
versions.
Additional observations:
1. The {NSData, NSAttributedString, NSCharacterSet, NSPipe,
NSDate} clusters do _not_
appear to be broken like {NSString, NSArray, NSDictionary,
NSNumber, NSSet} are.
I can't see any consistent pattern distinguishing the two
groups.
2. Substituting -classForCoder for -class in categories on
"broken" clusters should be safe
in most instances, as -classForCoder is supposed to return
the public class for instances
of private cluster clases.
It doesn't always, however.
NSPipe returns NSConcretePipe for classForCoder, but
NSConcretePipe appears to
support NSPipe's one public class method.
3. I'm filing this as a bug.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden