[MacRuby-devel] Immutable foundation objects

Laurent Sansonetti lsansonetti at apple.com
Mon Feb 15 12:05:06 PST 2010


On Feb 15, 2010, at 3:18 AM, Thibault Martin-Lagardette wrote:
> Hi Erik!
> 
> NSArray, when instanciated, becomes the equivalent of a ruby array, see for yourself with macirb:
> >> a = NSArray.alloc.init
> => []
> >> a.class
> => Array
> 
> However, you are right, it might need to become frozen, because otherwise, this happens:
> >> a << "MacRuby"
> 2010-02-15 11:57:08.766 macruby[98594:903] -[__NSArray0 addObject:]: unrecognized selector sent to instance 0x20022e820
> uncaught Objective-C/C++ exception...
> 2010-02-15 11:57:08.795 macruby[98594:903] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArray0 addObject:]: unrecognized selector sent to instance 0x20022e820'
> 
> And this is not really what we want :-)
> 
> Laurent, what were your plans about that? Should we modify NSArray.m and use an NSMutableArray, or should we freeze NSArray instances?

This should behave as expected on 0.5, on 0.6 it is a work in progress :)

Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20100215/94f63064/attachment.html>


More information about the MacRuby-devel mailing list