#671: MacRuby developers can't know if their arrays are mutable or immutable -------------------------------------+-------------------------------------- Reporter: mattaimone...@… | Owner: lsansone...@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.6 Component: MacRuby | Keywords: -------------------------------------+-------------------------------------- The following code will raise an exception:
{{{ [1,2,3].copy << 4 }}} The reason why is because Array implements NSCopy and calling #copy on a mutable array will return an immutable version. So everything is normal, the only problem is that since the 0.6 Array rewrite, one can't figure out if his array is mutable or not: {{{ NSArray.arrayWithObjects('terrans', 'zerg', 'protoss', nil).class => Array NSMutableArray.arrayWithObjects('terrans', 'zerg', 'protoss', nil).class => Array NSMutableArray.arrayWithObjects('terrans', 'zerg', 'protoss', nil).copy.class => Array [1,2,3].class => Array ruby-1.9.1-p243 > [1,2,3].copy.class => Array ruby-1.9.1-p243 > [1,2,3].copy.frozen? => false }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/671> MacRuby <http://macruby.org/> _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel