• 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: Ruby/Python - mixed language apps, and garbage collection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ruby/Python - mixed language apps, and garbage collection


  • Subject: Re: Ruby/Python - mixed language apps, and garbage collection
  • From: Bill Bumgarner <email@hidden>
  • Date: Sun, 18 Nov 2007 09:32:31 -0800

On Nov 18, 2007, at 7:58 AM, Graham Perks wrote:
I couldn't find a more appropriate mailing list. I just have a couple of questions:

1) Can we add Python or Ruby classes to an existing Objective-C project? I can't find a sample that mixes languages. I tried adding some .rb files to my project, but they don't seem to be loaded at runtime. Is there a way to make this work (assuming mixing languages is supported at all)?

You need to add the bootstrap code necessary to bring up the Python or Ruby interpreter in your existing application. The easiest way to do this is to create a new Cocoa Python or Cocoa Ruby project, then copy/ paste out the bits from the main file(s) that are needed.


Some slight changes will be needed to those files to make it all work correctly. See the "embedding" documentation for your language of choice.

2) In the WWDC 2006 or 2007 slides there was a bullet about "Memory management does not work" and the vocal comment was that this was still being looked into. I didn't grasp the full consequences about this - was it saying no garbage collection for Python/Ruby programs at all? No garbage collection for mixed-language apps? Or just no GC on the Objective-C side of a mixed app? And, what is the current status of this rather important bullet?

Objective-C Garbage Collection cannot be enabled in Ruby/Python based Cocoa applications. Specifically, you can't use Objective-C objects on the scripting language side of the bridges.


If you are embedding Ruby or Python with the purpose of running straight ruby/python scripts, with non-object data coming from the objective-c side of the world, it isn't an issue.

(Technically, there really isn't a reason why you couldn't enable GC for RubyCocoa and PyObjC. You would need to recompile the bridges and Python/Ruby interpreters with GC enabled. Once enabled, you "just" need to make sure that any reference to an Objective-C object passed through to Ruby/Python continues to have a strong reference on the obj- c side of the bridge.)

b.bum


_______________________________________________

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: Ruby/Python - mixed language apps, and garbage collection
      • From: Graham Perks <email@hidden>
References: 
 >Ruby/Python - mixed language apps, and garbage collection (From: Graham Perks <email@hidden>)

  • Prev by Date: Re: Accessing C++ class method from ObjC++ code
  • Next by Date: Re: CATextLayer and CAConstraint
  • Previous by thread: Ruby/Python - mixed language apps, and garbage collection
  • Next by thread: Re: Ruby/Python - mixed language apps, and garbage collection
  • Index(es):
    • Date
    • Thread