Re: Category errata in Objective-C
Re: Category errata in Objective-C
- Subject: Re: Category errata in Objective-C
- From: Ben Kennedy <email@hidden>
- Date: Fri, 29 Mar 2019 14:58:08 -0700
> On 29 Mar 2019, at 2:51 pm, Alex Zavatone <email@hidden> wrote:
>
> In all the docs on categories, I seem to have missed what the term for the
> text within the parens of a category declaration is called and what function
> it serves.
It's the category name. NSObject(Foo) represents "the Foo category on NSObject".
As for what function it serves, well, that's a good question. I've never been
aware of a runtime method for extracting such information or testing its
presence (as one can for protocol conformation, for example).
> Also, I seem to remember the esteemed Jens stating that as soon as a category
> class is in your project, it applies to all objects instantiated from the
> base class
Categories are like a benevolent disease: once linked and loaded, they live
everywhere.
> and we only had to do an import if we wanted to use the category methods in
> the debugger. Please correct me if I am wrong here.
>
> But I found out that that is not true. You have to import the category
> header into any classes where you want to take advantage of the category
> methods you added to a specific class.
These amount to the same thing, which is exposing the symbol names to your
interpreter or compiler for your convenient use as a programmer.
-ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden