• 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: Ryan Joseph <email@hidden>
  • Date: Fri, 3 Apr 2009 10:40:06 +0700

It's almost stupid this generated so much talk considering how trivial it is. Below is the Pascal code explaining.

// We pass dragTypes directly because it's interchangeable and using it with Objective-C runtime will not cause errors.

dragTypes := CFArrayCreate(nil, nil, 0, @kCFTypeArrayCallBacks);
view.registerForDraggedTypes(dragTypes);

// We must use the "Handle" which is the Objective-C object because dragTypes is a NSArray wrapper and passing a Pascal object to Objective-C runtime WILL cause errors

dragTypes := NSArray.array_;
view.registerForDraggedTypes(dragTypes.Handle);

I just didn't want users to type .Handle and let that choice be made a runtime behind the scenes. Was that worth everyones time? ;)

On Apr 3, 2009, at 10:26 AM, Chris Hanson wrote:

On Apr 2, 2009, at 7: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.

It's still not clear why you'd need or want this.

Bridges to Objective-C should be driven from Leopard's BridgeSupport infrastructure, which supplies all of the class/method information you should need for mechanically transforming whatever your language's messaging infrastructure is into what the Objective-C runtime expects.

Once you have a basic mechanical bridge in place, then you can start doing idiomatic things like bridging native types between your environment and Cocoa. The Ruby & Python bridges do this with strings and collections, for example.

I don't think a language bridge is the place to handle CF/Cocoa collection equivalence.

 -- Chris


Regards, Josef

_______________________________________________

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: Bill Bumgarner <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: Chris Hanson <email@hidden>)

  • Prev by Date: Re: Toll-free bridge type at runtime
  • Next by Date: Linking the "document edited" flag to the Undo menu item state
  • Previous by thread: Re: Toll-free bridge type at runtime
  • Next by thread: Re: Toll-free bridge type at runtime
  • Index(es):
    • Date
    • Thread