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

2011-10-19 Thread Chuck Remes

On Oct 19, 2011, at 12:41 AM, Terry Moore wrote:

> If you're not wring/changing the array no problems. But to be safe use 
> Object#freeze...
> 
> Terry Moore
> 
> On 19/10/2011, at 6:26 PM, Michael Johnston  wrote:
> 
>> Note, in my example I can also guarantee that none of the elements in b are 
>> going to be changed (for example, an array of strings)

Object#freeze is a terrible method. Supporting it requires an extra check 
(#frozen?) in every method that tries to modify an object. This is why Ruby is 
slow (certainly not the only reason, but decisions like this are everywhere). 

:)

Using #freeze won't save you but it will throw a RuntimeException if you try to 
modify a frozen object. So it's really only good for pointing out that you have 
a bug when you attempt to modify your immutable array.

cr


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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

2011-10-19 Thread Matt Aimonetti
The proper way to protect mutable objects is to use a mutex: 
http://www.ruby-doc.org/core-1.9.2/Mutex.html

- Matt

Sent from my iPhone

On Oct 19, 2011, at 8:06, Chuck Remes  wrote:

> 
> On Oct 19, 2011, at 12:41 AM, Terry Moore wrote:
> 
>> If you're not wring/changing the array no problems. But to be safe use 
>> Object#freeze...
>> 
>> Terry Moore
>> 
>> On 19/10/2011, at 6:26 PM, Michael Johnston  wrote:
>> 
>>> Note, in my example I can also guarantee that none of the elements in b are 
>>> going to be changed (for example, an array of strings)
> 
> Object#freeze is a terrible method. Supporting it requires an extra check 
> (#frozen?) in every method that tries to modify an object. This is why Ruby 
> is slow (certainly not the only reason, but decisions like this are 
> everywhere). 
> 
> :)
> 
> Using #freeze won't save you but it will throw a RuntimeException if you try 
> to modify a frozen object. So it's really only good for pointing out that you 
> have a bug when you attempt to modify your immutable array.
> 
> cr
> 
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] MacRuby app store guide

2011-10-19 Thread Elliot Temple
http://curi.us/1538-macruby-and-the-mac-app-store

Got my game in the app store. Hope these notes help others get things working 
too.

-- Elliot Temple
http://beginningofinfinity.com/




___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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

2011-10-19 Thread Terry Moore
Yes. But he does state it is a read only not modified array. My understanding 
is. 'Array' is an NSMutableArray, I was merely suggesting using freeze to throw 
that exception just in case there maybe some code attempting to write/modify.

Mutex is the way to go but it also has an overhead.

Terry Moore

On 20/10/2011, at 4:28 AM, Matt Aimonetti  wrote:

> The proper way to protect mutable objects is to use a mutex: 
> http://www.ruby-doc.org/core-1.9.2/Mutex.html
> 
> - Matt
> 
> Sent from my iPhone
> 
> On Oct 19, 2011, at 8:06, Chuck Remes  wrote:
> 
>> 
>> On Oct 19, 2011, at 12:41 AM, Terry Moore wrote:
>> 
>>> If you're not wring/changing the array no problems. But to be safe use 
>>> Object#freeze...
>>> 
>>> Terry Moore
>>> 
>>> On 19/10/2011, at 6:26 PM, Michael Johnston  wrote:
>>> 
 Note, in my example I can also guarantee that none of the elements in b 
 are going to be changed (for example, an array of strings)
>> 
>> Object#freeze is a terrible method. Supporting it requires an extra check 
>> (#frozen?) in every method that tries to modify an object. This is why Ruby 
>> is slow (certainly not the only reason, but decisions like this are 
>> everywhere). 
>> 
>> :)
>> 
>> Using #freeze won't save you but it will throw a RuntimeException if you try 
>> to modify a frozen object. So it's really only good for pointing out that 
>> you have a bug when you attempt to modify your immutable array.
>> 
>> cr
>> 
>> 
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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

2011-10-19 Thread Jordan K. Hubbard

On Oct 19, 2011, at 11:38 AM, Terry Moore wrote:

> Yes. But he does state it is a read only not modified array. My understanding 
> is. 'Array' is an NSMutableArray, I was merely suggesting using freeze to 
> throw that exception just in case there maybe some code attempting to 
> write/modify.
> 
> Mutex is the way to go but it also has an overhead.

Didn't somebody (Ernie?) already post a set of mix-ins for the mutable object 
classes that used a per-object GCD queue to serialize operations against the 
object?  If the mail archives were easier to search, I'd pull it up, but it 
isn't and I'm too lazy. :)

- Jordan

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] Xcode 4.2/IB and MacRuby: Works!

2011-10-19 Thread steve ross
In case nobody was watching…

So, today I downloaded Xcode 4.2, hoping IB would recognize outlets and actions 
in MacRuby classes. I also downloaded the newest version of MacRuby (0.12) from 
the nightly builds.

Now, my outlets and actions (as defined in my Ruby classes) are recognized in 
IB. Hurrah!!!
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Xcode 4.2/IB and MacRuby: Works!

2011-10-19 Thread Matt Aimonetti
Sorry we didn't make more noise about it, but after opening a bug report on
Apple's site and bugging a few people there, they fixed the Xcode bug.
The fix has been in all the recent Xcode beta but we forgot to announce it
when 4.2 was publicly released.

- Matt

On Wed, Oct 19, 2011 at 2:21 PM, steve ross  wrote:

> In case nobody was watching…
>
> So, today I downloaded Xcode 4.2, hoping IB would recognize outlets and
> actions in MacRuby classes. I also downloaded the newest version of MacRuby
> (0.12) from the nightly builds.
>
> Now, my outlets and actions (as defined in my Ruby classes) are recognized
> in IB. Hurrah!!!
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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

2011-10-19 Thread Matt Aimonetti
I believe someone (Ernie or someone else) did indeed extract some of the
dispatch gem's mixins.

- Matt

On Wed, Oct 19, 2011 at 1:43 PM, Jordan K. Hubbard  wrote:

>
> On Oct 19, 2011, at 11:38 AM, Terry Moore wrote:
>
> Yes. But he does state it is a read only not modified array. My
> understanding is. 'Array' is an NSMutableArray, I was merely suggesting
> using freeze to throw that exception just in case there maybe some code
> attempting to write/modify.
>
> Mutex is the way to go but it also has an overhead.
>
>
> Didn't somebody (Ernie?) already post a set of mix-ins for the mutable
> object classes that used a per-object GCD queue to serialize operations
> against the object?  If the mail archives were easier to search, I'd pull it
> up, but it isn't and I'm too lazy. :)
>
> - Jordan
>
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby app store guide

2011-10-19 Thread Matt Aimonetti
Thanks for sharing Eliott, that seems to be a bug with Xcode and it should
be affecting all 3rd party frameworks, not just MacRuby.
Quite strange, but thanks for showing how you worked around the signing
problem.

- Matt

On Wed, Oct 19, 2011 at 11:23 AM, Elliot Temple  wrote:

> http://curi.us/1538-macruby-and-the-mac-app-store
>
> Got my game in the app store. Hope these notes help others get things
> working too.
>
> -- Elliot Temple
> http://beginningofinfinity.com/
>
>
>
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel