Re: Toll-free bridge type at runtime
Re: Toll-free bridge type at runtime
- Subject: Re: Toll-free bridge type at runtime
- From: Michael Ash <email@hidden>
- Date: Thu, 2 Apr 2009 00:44:56 -0400
On Thu, Apr 2, 2009 at 12:33 AM, Ryan Joseph
<email@hidden> wrote:
> I'm trying to determine at runtime if a type is CoreFoundation or Cocoa, for
> example NSArray/CFArray. I must use Carbon API however to determine this
> before I attempt to use Cocoa methods for introspection.
>
> My first test was to use CFGetTypeID and CFCopyTypeIDDescription but they
> both returned CFArray on both Cocoa and CoreFoundation types. Maybe some of
> the Objective-C runtime functions could be used? But I'm not sure if they
> will crash taking CoreFoundation types for the purpose of testing. Are there
> any other clever ways to get this information? Thanks for helping.
The test cannot be performed, because the question does not make any sense.
Bridging doesn't mean that there are two types which interoperate.
Bridging means that there is one type, available under two names. It's
as though you have a friend named Bob, who sometimes also goes by
Bill. Now your question is, given a person, is this person Bob or is
it Bill? The answer is, both (or neither, if it's someone else).
An NSArray is a CFArray. A CFArray is an NSArray. You can't take one
of them and ask which one it is any more than you can ask your friend
whether he's Bob or Bill. They're just two names for the same thing.
Mike
_______________________________________________
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