Hi Henry,

>> And it's impossible to make Ruby to use ARC.
> 
> Why?
For memory management Objective-C uses a paradigm called "reference counting". 
The idea is very simple – when You need an object – You increase it reference 
count, when You no longer need it – You should decrease it. For example

NSString *name = @"Henry";

//when [[... alloc] init...] called (new object get created) – reference count 
of object is set to 1.
//who create's object is responsible to delete it
NSString *greeting = [[NSString alloc] initWithFormat:@"Hello %@",name];

//assume that greetings in an instance of NSMutableArray
[greetings addObject:greeting];

//we no longer need a greeting variable
[greeting release];

Everything is ok with this model, but You should manually track circular 
references.

ARC is just a smart preprocessor that knows Cocoa memory conventions and add's 
retain/release/autorelease calls to Your source code. And it can't figure out 
what to with circular references.

In Ruby we have garbage collector which is acts in whole different way – 
instead of modifying source code it track all created objects and delete one's 
that are no longer accessible from Your program. 

So, basically, ARC and GC are two conceptually different things which are even 
not replaceable by each other(circular references).

I encourage You to watch a BostonRB talk ( 
http://bostonrb.org/presentations/macruby-what-is-it-and-why-should-i-care-part-1
 ) by Joshua Ballanco (one of the MacRuby developers). In his talk he sad that 
GC isn't a major issue with bringing MacRuby to iOS. 

On 17 окт. 2011, at 08:43, Henry Maddocks wrote:

> 
> On 16/10/2011, at 9:07 PM, Igor Evsukov wrote:
> 
>> And it's impossible to make Ruby to use ARC.
> 
> Why?
> 
> Henry
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to