Hi John & Edward,

On Mar 30, 2009, at 11:27 AM, John Shea wrote:

Hello Edward,

well since no one else has answered i will speculate a bit (it might
provoke someone wiser).

I assume that the Ruby and the Objective C class are magically married
together perhaps via some sort of proxy class - since you cant as far
as i know add to an objective C class more instance methods - and
inserting a compiled class into a ruby class must be also problematic
- anyway it seems complicated. So I assume that the ruby class is
actually still a separate class. I must admit i never tried to extend
a compiled object C class - and I surprised it works as well as it
does.

In MacRuby, a Ruby class is a true Objective-C class. We try to use the Objective-C runtime for everything possible, however, because of some limitations of Objective-C there are things we need to do on the side, like for example maintaining instance variables (in Objective-C you cannot add an instance variable dynamically to a class).

On 3/30/09, Edward Hynes <[email protected]> wrote:
Is there a way to access instance variables defined in an Objective-C
class from a Ruby extension?

It is currently not implemented, but it's technically possible. A good work-around is to define accessors (properties) as John mentioned.

Laurent
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to