• 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: Toll-free bridge type at runtime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 23:11:06 -0400

On Thu, Apr 2, 2009 at 11:06 PM, Ryan Joseph
<email@hidden> wrote:
>
> On Apr 3, 2009, at 9:59 AM, Mark Ritchie wrote:
>
>> On 2-Apr-09, at 10:38 PM, Ryan Joseph wrote:
>>>
>>> I think I need explain what exactly I need this for. I'm making a Pascal
>>> bridge to Cocoa and it would be convenient if I could pass a CF type or a
>>> Pascal wrapper indiscriminately and decide at runtime how they should
>>> handled. If I knew the type was CF (thus NOT a wrapper, because it was
>>> created from a CoreFoundation function) I would not dereference the object
>>> and cause crashing.
>>
>> Hi Ryan
>>
>> Would the Pascal wrapper be a custom subclass of NSArray which has some
>> specific functionality for the bridge?  I'm trying to understand how this
>> wrapped array would be different from another array.   As Ali said, it would
>> be better if you could avoid the test.
>
> The wrapper is simply a Pascal object that encapsulates a Cocoa object. The
> underlying object is exactly the same as it appears in Cocoa, except it's
> accessed via Objective-C runtime functions. The fact it's a "wrapper" is
> really not important, I will be testing a CF type or the underlying Cocoa
> object.
>
> I'm prepared to abandon this if it's going to dangerous, it would just be
> nice if users didn't have to choose manually. Thanks.

I'm not sure what you mean by a "wrapper" here. Is this just a custom
Objective-C class? If so, then you can just test using Objective-C
introspection methods, like -isKindOfClass:

if([array isKindOfClass:[YourPascalWrapperClass class]])
    ...it's your wrapper...
else
    ...don't do anything funny...

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

  • Follow-Ups:
    • Re: Toll-free bridge type at runtime
      • From: Ryan Joseph <email@hidden>
References: 
 >Re: Toll-free bridge type at runtime (From: Greg Guerin <email@hidden>)
 >Re: Toll-free bridge type at runtime (From: Ali Ozer <email@hidden>)
 >Re: Toll-free bridge type at runtime (From: Ryan Joseph <email@hidden>)
 >Re: Toll-free bridge type at runtime (From: Mark Ritchie <email@hidden>)
 >Re: Toll-free bridge type at runtime (From: Ryan Joseph <email@hidden>)

  • Prev by Date: Re: Toll-free bridge type at runtime
  • Next by Date: Re: Toll-free bridge type at runtime
  • Previous by thread: Re: Toll-free bridge type at runtime
  • Next by thread: Re: Toll-free bridge type at runtime
  • Index(es):
    • Date
    • Thread