[MacRuby-devel] thread-safety and collections in macruby

Michael Johnston lastobelus at mac.com
Fri Oct 21 22:41:32 PDT 2011


Thanks, I am using:

results = NSArray.arrayWithArray(worker_results)

which although it reports true for is_a?(NSMutableArray) is immutable.

Cheerio,

Michael Johnston
lastobelus at mac.com




On 2011-10-20, at 3:47 PM, terl wrote:

> Just a note to the original question....
> 
> macruby collections are based on objc mutable collections...e.g.
> 
> a = %w{my array of strings}
> ["my","array","of"strings"]
> 
> b = a.dup.  b is still a mutable array.
> 
> c = NSarray.alloc.initWithArray( a ) immutable array
> 
> c << "hi"
> 
> runtime error cannot modify frozen/iimmutable array
> 
> b= a.dup.freeze
> 
> b << "hi"
> 
> behaves the same way as NSArray an immutable array.......
> 
> 
> Terry
> 
> 
> 
> On 21/10/2011, at 9:00 AM, Andy Park wrote:
> 
>> 
>> On 19 Oct 2011, at 22:43, Jordan K. Hubbard wrote:
>> 
>>>  If the mail archives were easier to search, I'd pull it up, but it isn't and I'm too lazy. :)
>>> 
>> 
>> I set up an entry in gmane for the mailing list a while ago in order to search the list a bit better: 
>> 
>> http://news.gmane.org/gmane.comp.lang.ruby.macintosh.devel
>> 
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20111021/551e7bfd/attachment.html>


More information about the MacRuby-devel mailing list