• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [self class] broken for clusters?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >[self class] broken for clusters? (From: Kirk Kerekes <email@hidden>)

  • Prev by Date: Re: Font scaling and string size problem?!?
  • Next by Date: Re: output from a mouse event
  • Previous by thread: [self class] broken for clusters?
  • Next by thread: Function call help
  • Index(es):
    • Date
    • Thread