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? -- Thibault Martin-Lagardette On Feb 14, 2010, at 16:29, Erik Österlund wrote:
Hello.
This is just a thought, but shouldn't for instance NSArray.alloc.init.frozen? return true, as it is immutable and cannot be changed? It is like a frozen version of NSMutableArray, isn't it? It's a bit confusing when asking an immutable Foundation object if it is frozen, and it says no... On the other hand, I suppose it's possible to create categories that add behavior that somehow modifies the object.
Any thoughts on this?
Thanks. _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel