[MacRuby-devel] MacRuby Unit Test Code Coverage

2011-02-13 Thread Gabriel Ayuso
MacRuby is great for testing not only MacRuby code but also Objective-C code. I 
find it nicer than using OCTest and OCMock.
Is there a way to use existing code coverage tools such as rcov or gcov to 
check the coverage of MacRuby unit tests?

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


Re: [MacRuby-devel] Issue with running unit tests when requiring rubygems

2011-02-13 Thread Eloy Duran
Did you also try installing the latest minitest + mocha as suggested? I would 
expect that to fix such issues. Which would also mean that, like Joshua 
suggested, we should update our version in stdlib.

On 11 feb 2011, at 23:53, Gabriel Ayuso wrote:

> I did a little more testing and I found out that the problem is apparently by 
> how Mocha changes Test::Unit::TestUnit.
> 
> The only way I was able to make it work was the following:
> 
>  require 'rubygems'
>  gem 'mocha'
>  require 'mocha'
>  require 'test/unit'
>  class QuickTest < Test::Unit::TestCase
>   include Mocha::API
>   def test_quick
>   obj = mock("test")
>   obj.expects(:do).returns(false)
>   assert( obj.do )
>   end
> end
> 
> If I required 'mocha' after 'test/unit' then the NoMethodError exception 
> would be thrown:
> 
> uncaught Objective-C/C++ exception...
> 2011-02-11 23:43:50.675 macruby[83143:903] *** Terminating app due to 
> uncaught exception 'NoMethodError', reason: 
> '/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/1.9.2/minitest/unit.rb:641:in
>  `block': undefined method `run' for # 
> (NoMethodError)
> 
> Gabriel Ayuso
> 
> On Feb 11, 2011, at 3:59 PM, Joshua Ballanco wrote:
> 
>> Considering that the updated minitest library also contains the new 
>> benchmarking facilities (though I don't think that part was officially 
>> adopted by MRI), it might be worth considering pulling from upstream.
>> 
>> On Fri, Feb 11, 2011 at 9:37 AM, Eloy Duran  wrote:
>> This *might* be because the minitest version in our stdlib is
>> outdated. You can try to install the minitest gem and require that
>> instead and see if that fixes it.
>> 
>> On Fri, Feb 11, 2011 at 3:24 PM, Gabriel Ayuso  
>> wrote:
>> > I wanted to try using mocha to write unit tests with mocks. After requiring
>> > "rubygems" a NoMethodError exception was thrown when attempting to run the
>> > tests. The method which wasn't found was 'run'.
>> > If I remove the call to require "rubygems" my test fails because I can't 
>> > use
>> > mocha but the NoMethodError exception which was thrown is not thrown
>> > anymore.
>> > Am I missing something?
>> > Thanks,
>> > Gabriel Ayuso
>> > ___
>> > 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
> 
> ___
> 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] Issue with running unit tests when requiring rubygems

2011-02-13 Thread Gabriel Ayuso
I reinstalled the minitest and mocha gems to the following versions: 
minitest-2.0.2, mocha-0.9.12
The same issue I described before occurred once again.

Here's the code I ran on macirb and the result: 

require 'rubygems'  #=> true
gem 'minitest'  #=> true
require 'test/unit' #=> true
require 'mocha' #=> true
class QuickTest < Test::Unit::TestCase
   def test_quick
 obj = mock('obj')
 obj.expects(:a).returns(true)
 assert( obj.a )
   end
 end# => nil
exit

Run options: --seed 43199

# Running tests:

uncaught Objective-C/C++ exception...
2011-02-13 14:47:45.996 macruby[25824:903] *** Terminating app due to uncaught 
exception 'NoMethodError', reason: 
'/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/Gems/1.9.2/gems/minitest-2.0.2/lib/minitest/unit.rb:664:in
 `block': undefined method `run' for # 
(NoMethodError)

from 
/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/Gems/1.9.2/gems/minitest-2.0.2/lib/minitest/unit.rb:657:in
 `_run_suite:'

from 
/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/Gems/1.9.2/gems/minitest-2.0.2/lib/minitest/unit.rb:647:in
 `block'

from 
/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/Gems/1.9.2/gems/minitest-2.0.2/lib/minitest/unit.rb:647:in
 `_run_suites:'

from 
/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/Gems/1.9.2/gems/minitest-2.0.2/lib/minitest/unit.rb:623:in
 `_run_anything:'

from 
/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/Gems/1.9.2/gems/minitest-2.0.2/lib/minitest/unit.rb:778:in
 `run_tests'

from 
/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/Gems/1.9.2/gems/minitest-2.0.2/lib/minitest/unit.rb:765:in
 `block'

from 
/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/Gems/1.9.2/gems/minitest-2.0.2/lib/minitest/unit.rb:764:in
 `run:'

from 
/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/Gems/1.9.2/gems/minitest-2.0.2/lib/minitest/unit.rb:558:in
 `block'
'

Gabriel Ayuso

On Feb 13, 2011, at 1:08 PM, Eloy Duran wrote:

> Did you also try installing the latest minitest + mocha as suggested? I would 
> expect that to fix such issues. Which would also mean that, like Joshua 
> suggested, we should update our version in stdlib.
> 
> On 11 feb 2011, at 23:53, Gabriel Ayuso wrote:
> 
>> I did a little more testing and I found out that the problem is apparently 
>> by how Mocha changes Test::Unit::TestUnit.
>> 
>> The only way I was able to make it work was the following:
>> 
>>  require 'rubygems'
>>  gem 'mocha'
>>  require 'mocha'
>>  require 'test/unit'
>>  class QuickTest < Test::Unit::TestCase
>>  include Mocha::API
>>  def test_quick
>>  obj = mock("test")
>>  obj.expects(:do).returns(false)
>>  assert( obj.do )
>>  end
>> end
>> 
>> If I required 'mocha' after 'test/unit' then the NoMethodError exception 
>> would be thrown:
>> 
>> uncaught Objective-C/C++ exception...
>> 2011-02-11 23:43:50.675 macruby[83143:903] *** Terminating app due to 
>> uncaught exception 'NoMethodError', reason: 
>> '/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/1.9.2/minitest/unit.rb:641:in
>>  `block': undefined method `run' for # 
>> (NoMethodError)
>> 
>> Gabriel Ayuso
>> 
>> On Feb 11, 2011, at 3:59 PM, Joshua Ballanco wrote:
>> 
>>> Considering that the updated minitest library also contains the new 
>>> benchmarking facilities (though I don't think that part was officially 
>>> adopted by MRI), it might be worth considering pulling from upstream.
>>> 
>>> On Fri, Feb 11, 2011 at 9:37 AM, Eloy Duran  wrote:
>>> This *might* be because the minitest version in our stdlib is
>>> outdated. You can try to install the minitest gem and require that
>>> instead and see if that fixes it.
>>> 
>>> On Fri, Feb 11, 2011 at 3:24 PM, Gabriel Ayuso  
>>> wrote:
>>> > I wanted to try using mocha to write unit tests with mocks. After 
>>> > requiring
>>> > "rubygems" a NoMethodError exception was thrown when attempting to run the
>>> > tests. The method which wasn't found was 'run'.
>>> > If I remove the call to require "rubygems" my test fails because I can't 
>>> > use
>>> > mocha but the NoMethodError exception which was thrown is not thrown
>>> > anymore.
>>> > Am I missing something?
>>> > Thanks,
>>> > Gabriel Ayuso
>>> > ___
>>> > 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://list

[MacRuby-devel] MacRuby 0.9 - NSDate initWithTimeInterval:sinceDate: problem

2011-02-13 Thread Jonathan Waddilove
Hi, I have been trying to use the NSDate initWithTimeInterval:sinceDate: method 
to measure elapsed times.

I know there has been some discussion about the mapping from Cocoa NSDate to 
Ruby Time and back but I'm not sure if this is supposed to be working now?

Here's a snip of code that calculates the interval using Ruby Time and then 
NSDate

#!/usr/local/bin/macruby
puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: #{MACRUBY_VERSION}"

puts "\n\nRuby vesion - works as expected"
point_in_time = Time.now
puts "Ruby start time #{point_in_time}"
sleep(1)
later_time = Time.now
puts "Later time: #{later_time}, interval: #{later_time - point_in_time} 
seconds"

puts "\n\nFailing Cocoa version"
cocoaTime = NSDate.date
puts "Coca start time: #{cocoaTime}"
sleep(1)
cocoaFinishTime = NSDate.date
puts "Cocoa Later time: #{cocoaFinishTime}, interval: 
#{cocoaFinishTime.timeIntervalSinceDate( cocoaFinishTime)} seconds"


And here's the output, note the NSDate sees zero intervale...
Ruby Version: 1.9.2, MacRuby Version: 0.8


Ruby vesion - works as expected
Ruby start time 2011-02-13 16:33:23 +
Later time: 2011-02-13 16:33:24 +, interval: 1.000694 seconds


Failing Cocoa version
Coca start time: 2011-02-13 16:33:24 +
Cocoa Later time: 2011-02-13 16:33:25 +, interval: 0.0 seconds

User error? or do I need to file a ticket?

Best wishes and thanks, Jonathan

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


[MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Jonathan Waddilove
Hi, another MacRuby 0.9 question...

I've been trying to use lambda and/or Proc.new to provide callback blocks (as 
suggested in Matt's excellent draft book). Again I have seen discussions about 
problems in this area and for me all the suggested variants of code fail.

Here's a snip of failing code:

#!/usr/local/bin/macruby
puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: #{MACRUBY_VERSION}"

a = [1, 2, 3, 4, 5,]

a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
  puts "I'll bet this never displays"
  })

and here's the resulting crash...

Any suggestions?  many thanks,  Jonathan


Process: macruby [23078]
Path:
/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
Identifier:  macruby
Version: ??? (???)
Code Type:   X86-64 (Native)
Parent Process:  ruby [23074]

Date/Time:   2011-02-13 16:50:33.806 +
OS Version:  Mac OS X 10.6.6 (10J567)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
objc[23078]: garbage collection is ON

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   ??? 00 0 + 0
1   ??? 0x000102d63ac6 0 + 4342561478
2   libmacruby.dylib0x00010014a0b3 rb_vm_dispatch + 1331
3   ??? 0x000102d5a536 0 + 4342523190
4   ??? 0x000102d63806 0 + 4342560774
5   libmacruby.dylib0x000100162d53 rb_vm_run + 531
6   libmacruby.dylib0x0001000408f0 ruby_run_node + 80
7   macruby 0x00010d28 main + 152
8   macruby 0x00010c88 start + 52

Thread 1:
0   libSystem.B.dylib   0x7fff88fe5f8a __workq_kernreturn + 
10
1   libSystem.B.dylib   0x7fff88fe639c _pthread_wqthread + 
917
2   libSystem.B.dylib   0x7fff88fe6005 start_wqthread + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x7fff5fbfddc0  rbx: 0x  rcx: 0x7fff5fbfdf0f  
rdx: 0x
  rdi: 0x0002000bed00  rsi: 0x0002000bec00  rbp: 0x7fff5fbfdf40  
rsp: 0x7fff5fbfdcf8
   r8: 0x0002   r9: 0x0005  r10: 0x0001  
r11: 0x000100af9000
  r12: 0x0002000bec00  r13: 0x  r14: 0x0005  
r15: 0x
  rip: 0x  rfl: 0x00010246  cr2: 0x

Binary Images:
   0x1 -0x10ff7 +macruby ??? (???) 
<4408616F-9F77-025F-C278-91F945728AB0> /usr/local/bin/macruby
   0x13000 -0x100a29fd7 +libmacruby.dylib 0.8.0 (compatibility 
0.8.0) <8910242D-90F3-32AC-A4CA-99D5C316AEB8> 
/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/libmacruby.dylib
0x7fff5fc0 - 0x7fff5fc3bdef  dyld 132.1 (???) 
<486E6C61-1197-CC7C-2197-82CE505102D7> /usr/lib/dyld
0x7fff801f1000 - 0x7fff802aafff  libsqlite3.dylib 9.6.0 (compatibility 
9.0.0) <2C5ED312-E646-9ADE-73A9-6199A2A43150> /usr/lib/libsqlite3.dylib
0x7fff802ba000 - 0x7fff80478fff  libicucore.A.dylib 40.0.0 
(compatibility 1.0.0) <781E7B63-2AD0-E9BA-927C-4521DB616D02> 
/usr/lib/libicucore.A.dylib
0x7fff809d - 0x7fff80a8dff7  com.apple.CoreServices.OSServices 357 
(357) <7B22626F-D544-1955-CC53-240F4CACEB4A> 
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
0x7fff815d5000 - 0x7fff815ebfef  libbsm.0.dylib ??? (???) 
<42D3023A-A1F7-4121-6417-FCC6B51B3E90> /usr/lib/libbsm.0.dylib
0x7fff817b9000 - 0x7fff817bdff7  libmathCommon.A.dylib 315.0.0 
(compatibility 1.0.0) <95718673-FEEE-B6ED-B127-BCDBDB60D4E5> 
/usr/lib/system/libmathCommon.A.dylib
0x7fff81cbb000 - 0x7fff81d05ff7  com.apple.Metadata 10.6.3 (507.15) 
<5170FCE0-ED6C-2E3E-AB28-1DDE3F628FC5> 
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
0x7fff8208d000 - 0x7fff82310ff7  com.apple.Foundation 6.6.4 (751.42) 
 
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
0x7fff82318000 - 0x7fff82340fff  com.apple.DictionaryServices 1.1.2 
(1.1.2)  
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices
0x7fff8234d000 - 0x7fff8234dff7  com.apple.CoreServices 44 (44) 
 
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
0x7fff8353c000 - 0x7fff83588fff  libauto.dylib ??? (???) 
 /usr/lib/libauto.dylib
0x7fff83ecb000 - 0x7fff83ed9ff7  libkxld.dylib ??? (???) 
<27713C39-0E51-8F5A-877B-C5539C96A520> /usr/lib/system/libkxld.dylib
0x7

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Robert Payne
Hi Jonathan,

The syntax looks good and it works on my end. Are you using a nightly of 
MacRuby or the 0.8 trunk?

a = [0,1,2,3,4]
puts "#{a}"
a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
puts "object: #{object}"
})

On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:

> Hi, another MacRuby 0.9 question...
> 
> I've been trying to use lambda and/or Proc.new to provide callback blocks (as 
> suggested in Matt's excellent draft book). Again I have seen discussions 
> about problems in this area and for me all the suggested variants of code 
> fail.
> 
> Here's a snip of failing code:
> 
> #!/usr/local/bin/macruby
> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: #{MACRUBY_VERSION}"
> 
> a = [1, 2, 3, 4, 5,]
> 
> a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
> puts "I'll bet this never displays"
> })
>   
> and here's the resulting crash...
> 
> Any suggestions?  many thanks,  Jonathan
> 
> 
> Process: macruby [23078]
> Path:
> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
> Identifier:  macruby
> Version: ??? (???)
> Code Type:   X86-64 (Native)
> Parent Process:  ruby [23074]
> 
> Date/Time:   2011-02-13 16:50:33.806 +
> OS Version:  Mac OS X 10.6.6 (10J567)
> Report Version:  6
> 
> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
> Exception Codes: KERN_INVALID_ADDRESS at 0x
> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
> 
> Application Specific Information:
> objc[23078]: garbage collection is ON
> 
> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
> 0   ???   00 0 + 0
> 1   ???   0x000102d63ac6 0 + 4342561478
> 2   libmacruby.dylib  0x00010014a0b3 rb_vm_dispatch + 1331
> 3   ???   0x000102d5a536 0 + 4342523190
> 4   ???   0x000102d63806 0 + 4342560774
> 5   libmacruby.dylib  0x000100162d53 rb_vm_run + 531
> 6   libmacruby.dylib  0x0001000408f0 ruby_run_node + 80
> 7   macruby   0x00010d28 main + 152
> 8   macruby   0x00010c88 start + 52
> 
> Thread 1:
> 0   libSystem.B.dylib 0x7fff88fe5f8a __workq_kernreturn + 
> 10
> 1   libSystem.B.dylib 0x7fff88fe639c _pthread_wqthread + 
> 917
> 2   libSystem.B.dylib 0x7fff88fe6005 start_wqthread + 13
> 
> Thread 0 crashed with X86 Thread State (64-bit):
>  rax: 0x7fff5fbfddc0  rbx: 0x  rcx: 0x7fff5fbfdf0f  
> rdx: 0x
>  rdi: 0x0002000bed00  rsi: 0x0002000bec00  rbp: 0x7fff5fbfdf40  
> rsp: 0x7fff5fbfdcf8
>   r8: 0x0002   r9: 0x0005  r10: 0x0001  
> r11: 0x000100af9000
>  r12: 0x0002000bec00  r13: 0x  r14: 0x0005  
> r15: 0x
>  rip: 0x  rfl: 0x00010246  cr2: 0x
> 
> Binary Images:
>   0x1 -0x10ff7 +macruby ??? (???) 
> <4408616F-9F77-025F-C278-91F945728AB0> /usr/local/bin/macruby
>   0x13000 -0x100a29fd7 +libmacruby.dylib 0.8.0 (compatibility 
> 0.8.0) <8910242D-90F3-32AC-A4CA-99D5C316AEB8> 
> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/libmacruby.dylib
>0x7fff5fc0 - 0x7fff5fc3bdef  dyld 132.1 (???) 
> <486E6C61-1197-CC7C-2197-82CE505102D7> /usr/lib/dyld
>0x7fff801f1000 - 0x7fff802aafff  libsqlite3.dylib 9.6.0 (compatibility 
> 9.0.0) <2C5ED312-E646-9ADE-73A9-6199A2A43150> /usr/lib/libsqlite3.dylib
>0x7fff802ba000 - 0x7fff80478fff  libicucore.A.dylib 40.0.0 
> (compatibility 1.0.0) <781E7B63-2AD0-E9BA-927C-4521DB616D02> 
> /usr/lib/libicucore.A.dylib
>0x7fff809d - 0x7fff80a8dff7  com.apple.CoreServices.OSServices 357 
> (357) <7B22626F-D544-1955-CC53-240F4CACEB4A> 
> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
>0x7fff815d5000 - 0x7fff815ebfef  libbsm.0.dylib ??? (???) 
> <42D3023A-A1F7-4121-6417-FCC6B51B3E90> /usr/lib/libbsm.0.dylib
>0x7fff817b9000 - 0x7fff817bdff7  libmathCommon.A.dylib 315.0.0 
> (compatibility 1.0.0) <95718673-FEEE-B6ED-B127-BCDBDB60D4E5> 
> /usr/lib/system/libmathCommon.A.dylib
>0x7fff81cbb000 - 0x7fff81d05ff7  com.apple.Metadata 10.6.3 (507.15) 
> <5170FCE0-ED6C-2E3E-AB28-1DDE3F628FC5> 
> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
>0x7fff8208d000 - 0x7fff82310ff7  com.apple.Foundation 6.6.4 (751.42) 
>  
> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
>0x7fff82318000 - 0x7fff82340fff  com.apple.DictionaryServices 1.1.2 
> (1.1.2)  
> /System/Library/Frameworks/CoreServices.framework/Versions/A/

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Jonathan Waddilove
Hi Robert, Thanks for the quick response.

I'm using trunk (installed straight from the MacRuby front page). For what it's 
worth I have both Xcode3 and Xcode4 installed but can happily reproduce the 
error in textmate/xcode3/macirb

regards Jonathan

On 13 Feb 2011, at 17:31, Robert Payne wrote:

> Hi Jonathan,
> 
> The syntax looks good and it works on my end. Are you using a nightly of 
> MacRuby or the 0.8 trunk?
> 
> a = [0,1,2,3,4]
> puts "#{a}"
> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>   puts "object: #{object}"
> })
> 
> On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
> 
>> Hi, another MacRuby 0.9 question...
>> 
>> I've been trying to use lambda and/or Proc.new to provide callback blocks 
>> (as suggested in Matt's excellent draft book). Again I have seen discussions 
>> about problems in this area and for me all the suggested variants of code 
>> fail.
>> 
>> Here's a snip of failing code:
>> 
>> #!/usr/local/bin/macruby
>> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: #{MACRUBY_VERSION}"
>> 
>> a = [1, 2, 3, 4, 5,]
>> 
>> a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
>>puts "I'll bet this never displays"
>>})
>>  
>> and here's the resulting crash...
>> 
>> Any suggestions?  many thanks,  Jonathan
>> 
>> 
>> Process: macruby [23078]
>> Path:
>> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
>> Identifier:  macruby
>> Version: ??? (???)
>> Code Type:   X86-64 (Native)
>> Parent Process:  ruby [23074]
>> 
>> Date/Time:   2011-02-13 16:50:33.806 +
>> OS Version:  Mac OS X 10.6.6 (10J567)
>> Report Version:  6
>> 
>> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
>> Exception Codes: KERN_INVALID_ADDRESS at 0x
>> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
>> 
>> Application Specific Information:
>> objc[23078]: garbage collection is ON
>> 
>> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
>> 0   ???  00 0 + 0
>> 1   ???  0x000102d63ac6 0 + 4342561478
>> 2   libmacruby.dylib 0x00010014a0b3 rb_vm_dispatch + 1331
>> 3   ???  0x000102d5a536 0 + 4342523190
>> 4   ???  0x000102d63806 0 + 4342560774
>> 5   libmacruby.dylib 0x000100162d53 rb_vm_run + 531
>> 6   libmacruby.dylib 0x0001000408f0 ruby_run_node + 80
>> 7   macruby  0x00010d28 main + 152
>> 8   macruby  0x00010c88 start + 52
>> 
>> Thread 1:
>> 0   libSystem.B.dylib0x7fff88fe5f8a __workq_kernreturn + 
>> 10
>> 1   libSystem.B.dylib0x7fff88fe639c _pthread_wqthread + 
>> 917
>> 2   libSystem.B.dylib0x7fff88fe6005 start_wqthread + 13
>> 
>> Thread 0 crashed with X86 Thread State (64-bit):
>> rax: 0x7fff5fbfddc0  rbx: 0x  rcx: 0x7fff5fbfdf0f  
>> rdx: 0x
>> rdi: 0x0002000bed00  rsi: 0x0002000bec00  rbp: 0x7fff5fbfdf40  
>> rsp: 0x7fff5fbfdcf8
>>  r8: 0x0002   r9: 0x0005  r10: 0x0001  
>> r11: 0x000100af9000
>> r12: 0x0002000bec00  r13: 0x  r14: 0x0005  
>> r15: 0x
>> rip: 0x  rfl: 0x00010246  cr2: 0x
>> 
>> Binary Images:
>>  0x1 -0x10ff7 +macruby ??? (???) 
>> <4408616F-9F77-025F-C278-91F945728AB0> /usr/local/bin/macruby
>>  0x13000 -0x100a29fd7 +libmacruby.dylib 0.8.0 (compatibility 
>> 0.8.0) <8910242D-90F3-32AC-A4CA-99D5C316AEB8> 
>> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/libmacruby.dylib
>>   0x7fff5fc0 - 0x7fff5fc3bdef  dyld 132.1 (???) 
>> <486E6C61-1197-CC7C-2197-82CE505102D7> /usr/lib/dyld
>>   0x7fff801f1000 - 0x7fff802aafff  libsqlite3.dylib 9.6.0 (compatibility 
>> 9.0.0) <2C5ED312-E646-9ADE-73A9-6199A2A43150> /usr/lib/libsqlite3.dylib
>>   0x7fff802ba000 - 0x7fff80478fff  libicucore.A.dylib 40.0.0 
>> (compatibility 1.0.0) <781E7B63-2AD0-E9BA-927C-4521DB616D02> 
>> /usr/lib/libicucore.A.dylib
>>   0x7fff809d - 0x7fff80a8dff7  com.apple.CoreServices.OSServices 357 
>> (357) <7B22626F-D544-1955-CC53-240F4CACEB4A> 
>> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
>>   0x7fff815d5000 - 0x7fff815ebfef  libbsm.0.dylib ??? (???) 
>> <42D3023A-A1F7-4121-6417-FCC6B51B3E90> /usr/lib/libbsm.0.dylib
>>   0x7fff817b9000 - 0x7fff817bdff7  libmathCommon.A.dylib 315.0.0 
>> (compatibility 1.0.0) <95718673-FEEE-B6ED-B127-BCDBDB60D4E5> 
>> /usr/lib/system/libmathCommon.A.dylib
>>   0x7fff81cbb000 - 0x7fff81d05ff7  com.apple.Metadata 10.6.3 (507.15) 
>> <5170FCE0-ED6C-2E3E-AB28-1DDE3F628FC5> 
>> /System/Library/Frameworks/Cor

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Robert Payne
Hi Jonathan,

Can you try just exactly this in macirb?

framework "Cocoa"
a = [0,1,2,3,4]
a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
puts "#{object}"
})

It's working over here in MacIrb
On 14/02/2011, at 6:52 AM, Jonathan Waddilove wrote:

> Hi Robert, Thanks for the quick response.
> 
> I'm using trunk (installed straight from the MacRuby front page). For what 
> it's worth I have both Xcode3 and Xcode4 installed but can happily reproduce 
> the error in textmate/xcode3/macirb
> 
> regards Jonathan
> 
> On 13 Feb 2011, at 17:31, Robert Payne wrote:
> 
>> Hi Jonathan,
>> 
>> The syntax looks good and it works on my end. Are you using a nightly of 
>> MacRuby or the 0.8 trunk?
>> 
>> a = [0,1,2,3,4]
>> puts "#{a}"
>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>  puts "object: #{object}"
>> })
>> 
>> On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
>> 
>>> Hi, another MacRuby 0.9 question...
>>> 
>>> I've been trying to use lambda and/or Proc.new to provide callback blocks 
>>> (as suggested in Matt's excellent draft book). Again I have seen 
>>> discussions about problems in this area and for me all the suggested 
>>> variants of code fail.
>>> 
>>> Here's a snip of failing code:
>>> 
>>> #!/usr/local/bin/macruby
>>> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: #{MACRUBY_VERSION}"
>>> 
>>> a = [1, 2, 3, 4, 5,]
>>> 
>>> a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
>>>   puts "I'll bet this never displays"
>>>   })
>>> 
>>> and here's the resulting crash...
>>> 
>>> Any suggestions?  many thanks,  Jonathan
>>> 
>>> 
>>> Process: macruby [23078]
>>> Path:
>>> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
>>> Identifier:  macruby
>>> Version: ??? (???)
>>> Code Type:   X86-64 (Native)
>>> Parent Process:  ruby [23074]
>>> 
>>> Date/Time:   2011-02-13 16:50:33.806 +
>>> OS Version:  Mac OS X 10.6.6 (10J567)
>>> Report Version:  6
>>> 
>>> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
>>> Exception Codes: KERN_INVALID_ADDRESS at 0x
>>> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
>>> 
>>> Application Specific Information:
>>> objc[23078]: garbage collection is ON
>>> 
>>> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
>>> 0   ??? 00 0 + 0
>>> 1   ??? 0x000102d63ac6 0 + 4342561478
>>> 2   libmacruby.dylib0x00010014a0b3 rb_vm_dispatch + 1331
>>> 3   ??? 0x000102d5a536 0 + 4342523190
>>> 4   ??? 0x000102d63806 0 + 4342560774
>>> 5   libmacruby.dylib0x000100162d53 rb_vm_run + 531
>>> 6   libmacruby.dylib0x0001000408f0 ruby_run_node + 80
>>> 7   macruby 0x00010d28 main + 152
>>> 8   macruby 0x00010c88 start + 52
>>> 
>>> Thread 1:
>>> 0   libSystem.B.dylib   0x7fff88fe5f8a __workq_kernreturn + 
>>> 10
>>> 1   libSystem.B.dylib   0x7fff88fe639c _pthread_wqthread + 
>>> 917
>>> 2   libSystem.B.dylib   0x7fff88fe6005 start_wqthread + 13
>>> 
>>> Thread 0 crashed with X86 Thread State (64-bit):
>>> rax: 0x7fff5fbfddc0  rbx: 0x  rcx: 0x7fff5fbfdf0f  
>>> rdx: 0x
>>> rdi: 0x0002000bed00  rsi: 0x0002000bec00  rbp: 0x7fff5fbfdf40  
>>> rsp: 0x7fff5fbfdcf8
>>> r8: 0x0002   r9: 0x0005  r10: 0x0001  
>>> r11: 0x000100af9000
>>> r12: 0x0002000bec00  r13: 0x  r14: 0x0005  
>>> r15: 0x
>>> rip: 0x  rfl: 0x00010246  cr2: 0x
>>> 
>>> Binary Images:
>>> 0x1 -0x10ff7 +macruby ??? (???) 
>>> <4408616F-9F77-025F-C278-91F945728AB0> /usr/local/bin/macruby
>>> 0x13000 -0x100a29fd7 +libmacruby.dylib 0.8.0 (compatibility 
>>> 0.8.0) <8910242D-90F3-32AC-A4CA-99D5C316AEB8> 
>>> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/libmacruby.dylib
>>>  0x7fff5fc0 - 0x7fff5fc3bdef  dyld 132.1 (???) 
>>> <486E6C61-1197-CC7C-2197-82CE505102D7> /usr/lib/dyld
>>>  0x7fff801f1000 - 0x7fff802aafff  libsqlite3.dylib 9.6.0 (compatibility 
>>> 9.0.0) <2C5ED312-E646-9ADE-73A9-6199A2A43150> /usr/lib/libsqlite3.dylib
>>>  0x7fff802ba000 - 0x7fff80478fff  libicucore.A.dylib 40.0.0 
>>> (compatibility 1.0.0) <781E7B63-2AD0-E9BA-927C-4521DB616D02> 
>>> /usr/lib/libicucore.A.dylib
>>>  0x7fff809d - 0x7fff80a8dff7  com.apple.CoreServices.OSServices 357 
>>> (357) <7B22626F-D544-1955-CC53-240F4CACEB4A> 
>>> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
>>>  0x7fff815d5000 - 0x7fff815ebfef  libbsm.0.dylib ??? (???) 
>>> <42D3023A-A1F7-4121-6417-FCC6B51

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Jonathan Waddilove
Hello Robert,

Sorry, I must be using the 'other' macirb  ;-) - still doesn't work, here's the 
output

JTW:~ jonathan$ macirb
irb(main):001:0> framework "Cocoa"
=> true
irb(main):002:0> a = [0,1,2,3,4]
=> [0, 1, 2, 3, 4]
irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
irb(main):004:1>   puts "#{object}"
irb(main):005:0> })
Segmentation fault
JTW:~ jonathan$ 

regards,  Jonathan

On 13 Feb 2011, at 17:55, Robert Payne wrote:

> Hi Jonathan,
> 
> Can you try just exactly this in macirb?
> 
> framework "Cocoa"
> a = [0,1,2,3,4]
> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>   puts "#{object}"
> })
> 
> It's working over here in MacIrb
> On 14/02/2011, at 6:52 AM, Jonathan Waddilove wrote:
> 
>> Hi Robert, Thanks for the quick response.
>> 
>> I'm using trunk (installed straight from the MacRuby front page). For what 
>> it's worth I have both Xcode3 and Xcode4 installed but can happily reproduce 
>> the error in textmate/xcode3/macirb
>> 
>> regards Jonathan
>> 
>> On 13 Feb 2011, at 17:31, Robert Payne wrote:
>> 
>>> Hi Jonathan,
>>> 
>>> The syntax looks good and it works on my end. Are you using a nightly of 
>>> MacRuby or the 0.8 trunk?
>>> 
>>> a = [0,1,2,3,4]
>>> puts "#{a}"
>>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>> puts "object: #{object}"
>>> })
>>> 
>>> On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
>>> 
 Hi, another MacRuby 0.9 question...
 
 I've been trying to use lambda and/or Proc.new to provide callback blocks 
 (as suggested in Matt's excellent draft book). Again I have seen 
 discussions about problems in this area and for me all the suggested 
 variants of code fail.
 
 Here's a snip of failing code:
 
 #!/usr/local/bin/macruby
 puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: #{MACRUBY_VERSION}"
 
 a = [1, 2, 3, 4, 5,]
 
 a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
  puts "I'll bet this never displays"
  })

 and here's the resulting crash...
 
 Any suggestions?  many thanks,  Jonathan
 
 
 Process: macruby [23078]
 Path:
 /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
 Identifier:  macruby
 Version: ??? (???)
 Code Type:   X86-64 (Native)
 Parent Process:  ruby [23074]
 
 Date/Time:   2011-02-13 16:50:33.806 +
 OS Version:  Mac OS X 10.6.6 (10J567)
 Report Version:  6
 
 Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
 Exception Codes: KERN_INVALID_ADDRESS at 0x
 Crashed Thread:  0  Dispatch queue: com.apple.main-thread
 
 Application Specific Information:
 objc[23078]: garbage collection is ON
 
 Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
 0   ???00 0 + 0
 1   ???0x000102d63ac6 0 + 4342561478
 2   libmacruby.dylib   0x00010014a0b3 rb_vm_dispatch + 1331
 3   ???0x000102d5a536 0 + 4342523190
 4   ???0x000102d63806 0 + 4342560774
 5   libmacruby.dylib   0x000100162d53 rb_vm_run + 531
 6   libmacruby.dylib   0x0001000408f0 ruby_run_node + 80
 7   macruby0x00010d28 main + 152
 8   macruby0x00010c88 start + 52
 
 Thread 1:
 0   libSystem.B.dylib  0x7fff88fe5f8a __workq_kernreturn + 
 10
 1   libSystem.B.dylib  0x7fff88fe639c _pthread_wqthread + 
 917
 2   libSystem.B.dylib  0x7fff88fe6005 start_wqthread + 13
 
 Thread 0 crashed with X86 Thread State (64-bit):
 rax: 0x7fff5fbfddc0  rbx: 0x  rcx: 0x7fff5fbfdf0f  
 rdx: 0x
 rdi: 0x0002000bed00  rsi: 0x0002000bec00  rbp: 0x7fff5fbfdf40  
 rsp: 0x7fff5fbfdcf8
 r8: 0x0002   r9: 0x0005  r10: 0x0001  
 r11: 0x000100af9000
 r12: 0x0002000bec00  r13: 0x  r14: 0x0005  
 r15: 0x
 rip: 0x  rfl: 0x00010246  cr2: 0x
 
 Binary Images:
0x1 -0x10ff7 +macruby ??? (???) 
 <4408616F-9F77-025F-C278-91F945728AB0> /usr/local/bin/macruby
0x13000 -0x100a29fd7 +libmacruby.dylib 0.8.0 (compatibility 
 0.8.0) <8910242D-90F3-32AC-A4CA-99D5C316AEB8> 
 /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/libmacruby.dylib
 0x7fff5fc0 - 0x7fff5fc3bdef  dyld 132.1 (???) 
 <486E6C61-1197-CC7C-2197-82CE505102D7> /usr/lib/dyld
 0x7fff801f1000 - 0x7fff802aafff  libsqlite3.dylib 9.6.0 (compatibility 
 9.0.0) <2C5ED312-E646-9ADE

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Robert Payne
I just updated to the latest source just to be safe and I'm still not getting 
any issues with it... someone else might be able to help.

-Robert

On 14/02/2011, at 7:01 AM, Jonathan Waddilove wrote:

> Hello Robert,
> 
> Sorry, I must be using the 'other' macirb  ;-) - still doesn't work, here's 
> the output
> 
> JTW:~ jonathan$ macirb
> irb(main):001:0> framework "Cocoa"
> => true
> irb(main):002:0> a = [0,1,2,3,4]
> => [0, 1, 2, 3, 4]
> irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
> irb(main):004:1>   puts "#{object}"
> irb(main):005:0> })
> Segmentation fault
> JTW:~ jonathan$ 
> 
> regards,  Jonathan
> 
> On 13 Feb 2011, at 17:55, Robert Payne wrote:
> 
>> Hi Jonathan,
>> 
>> Can you try just exactly this in macirb?
>> 
>> framework "Cocoa"
>> a = [0,1,2,3,4]
>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>  puts "#{object}"
>> })
>> 
>> It's working over here in MacIrb
>> On 14/02/2011, at 6:52 AM, Jonathan Waddilove wrote:
>> 
>>> Hi Robert, Thanks for the quick response.
>>> 
>>> I'm using trunk (installed straight from the MacRuby front page). For what 
>>> it's worth I have both Xcode3 and Xcode4 installed but can happily 
>>> reproduce the error in textmate/xcode3/macirb
>>> 
>>> regards Jonathan
>>> 
>>> On 13 Feb 2011, at 17:31, Robert Payne wrote:
>>> 
 Hi Jonathan,
 
 The syntax looks good and it works on my end. Are you using a nightly of 
 MacRuby or the 0.8 trunk?
 
 a = [0,1,2,3,4]
 puts "#{a}"
 a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
puts "object: #{object}"
 })
 
 On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
 
> Hi, another MacRuby 0.9 question...
> 
> I've been trying to use lambda and/or Proc.new to provide callback blocks 
> (as suggested in Matt's excellent draft book). Again I have seen 
> discussions about problems in this area and for me all the suggested 
> variants of code fail.
> 
> Here's a snip of failing code:
> 
> #!/usr/local/bin/macruby
> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: #{MACRUBY_VERSION}"
> 
> a = [1, 2, 3, 4, 5,]
> 
> a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
> puts "I'll bet this never displays"
> })
>   
> and here's the resulting crash...
> 
> Any suggestions?  many thanks,  Jonathan
> 
> 
> Process: macruby [23078]
> Path:
> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
> Identifier:  macruby
> Version: ??? (???)
> Code Type:   X86-64 (Native)
> Parent Process:  ruby [23074]
> 
> Date/Time:   2011-02-13 16:50:33.806 +
> OS Version:  Mac OS X 10.6.6 (10J567)
> Report Version:  6
> 
> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
> Exception Codes: KERN_INVALID_ADDRESS at 0x
> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
> 
> Application Specific Information:
> objc[23078]: garbage collection is ON
> 
> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
> 0   ???   00 0 + 0
> 1   ???   0x000102d63ac6 0 + 
> 4342561478
> 2   libmacruby.dylib  0x00010014a0b3 
> rb_vm_dispatch + 1331
> 3   ???   0x000102d5a536 0 + 
> 4342523190
> 4   ???   0x000102d63806 0 + 
> 4342560774
> 5   libmacruby.dylib  0x000100162d53 rb_vm_run + 
> 531
> 6   libmacruby.dylib  0x0001000408f0 
> ruby_run_node + 80
> 7   macruby   0x00010d28 main + 152
> 8   macruby   0x00010c88 start + 52
> 
> Thread 1:
> 0   libSystem.B.dylib 0x7fff88fe5f8a 
> __workq_kernreturn + 10
> 1   libSystem.B.dylib 0x7fff88fe639c 
> _pthread_wqthread + 917
> 2   libSystem.B.dylib 0x7fff88fe6005 
> start_wqthread + 13
> 
> Thread 0 crashed with X86 Thread State (64-bit):
> rax: 0x7fff5fbfddc0  rbx: 0x  rcx: 0x7fff5fbfdf0f 
>  rdx: 0x
> rdi: 0x0002000bed00  rsi: 0x0002000bec00  rbp: 0x7fff5fbfdf40 
>  rsp: 0x7fff5fbfdcf8
> r8: 0x0002   r9: 0x0005  r10: 0x0001  
> r11: 0x000100af9000
> r12: 0x0002000bec00  r13: 0x  r14: 0x0005 
>  r15: 0x
> rip: 0x  rfl: 0x00010246  cr2: 0x
> 
> Binary Images:
>   0x1 -0x10ff7 +macruby ??? (???) 
> <4408616F-9F77-025F-C278-91F

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Jonathan Waddilove
OK, thanks for having a look  I thought I'd raise the issue incase it's a 
bug that needs addressing before 1.0

I guess it could be something subtle in my environment.

best wishes, Jonathan

On 13 Feb 2011, at 18:11, Robert Payne wrote:

> I just updated to the latest source just to be safe and I'm still not getting 
> any issues with it... someone else might be able to help.
> 
> -Robert
> 
> On 14/02/2011, at 7:01 AM, Jonathan Waddilove wrote:
> 
>> Hello Robert,
>> 
>> Sorry, I must be using the 'other' macirb  ;-) - still doesn't work, here's 
>> the output
>> 
>> JTW:~ jonathan$ macirb
>> irb(main):001:0> framework "Cocoa"
>> => true
>> irb(main):002:0> a = [0,1,2,3,4]
>> => [0, 1, 2, 3, 4]
>> irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>> irb(main):004:1>   puts "#{object}"
>> irb(main):005:0> })
>> Segmentation fault
>> JTW:~ jonathan$ 
>> 
>> regards,  Jonathan
>> 
>> On 13 Feb 2011, at 17:55, Robert Payne wrote:
>> 
>>> Hi Jonathan,
>>> 
>>> Can you try just exactly this in macirb?
>>> 
>>> framework "Cocoa"
>>> a = [0,1,2,3,4]
>>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>> puts "#{object}"
>>> })
>>> 
>>> It's working over here in MacIrb
>>> On 14/02/2011, at 6:52 AM, Jonathan Waddilove wrote:
>>> 
 Hi Robert, Thanks for the quick response.
 
 I'm using trunk (installed straight from the MacRuby front page). For what 
 it's worth I have both Xcode3 and Xcode4 installed but can happily 
 reproduce the error in textmate/xcode3/macirb
 
 regards Jonathan
 
 On 13 Feb 2011, at 17:31, Robert Payne wrote:
 
> Hi Jonathan,
> 
> The syntax looks good and it works on my end. Are you using a nightly of 
> MacRuby or the 0.8 trunk?
> 
> a = [0,1,2,3,4]
> puts "#{a}"
> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>   puts "object: #{object}"
> })
> 
> On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
> 
>> Hi, another MacRuby 0.9 question...
>> 
>> I've been trying to use lambda and/or Proc.new to provide callback 
>> blocks (as suggested in Matt's excellent draft book). Again I have seen 
>> discussions about problems in this area and for me all the suggested 
>> variants of code fail.
>> 
>> Here's a snip of failing code:
>> 
>> #!/usr/local/bin/macruby
>> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: #{MACRUBY_VERSION}"
>> 
>> a = [1, 2, 3, 4, 5,]
>> 
>> a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
>>puts "I'll bet this never displays"
>>})
>>  
>> and here's the resulting crash...
>> 
>> Any suggestions?  many thanks,  Jonathan
>> 
>> 
>> Process: macruby [23078]
>> Path:
>> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
>> Identifier:  macruby
>> Version: ??? (???)
>> Code Type:   X86-64 (Native)
>> Parent Process:  ruby [23074]
>> 
>> Date/Time:   2011-02-13 16:50:33.806 +
>> OS Version:  Mac OS X 10.6.6 (10J567)
>> Report Version:  6
>> 
>> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
>> Exception Codes: KERN_INVALID_ADDRESS at 0x
>> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
>> 
>> Application Specific Information:
>> objc[23078]: garbage collection is ON
>> 
>> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
>> 0   ???  00 0 + 0
>> 1   ???  0x000102d63ac6 0 + 
>> 4342561478
>> 2   libmacruby.dylib 0x00010014a0b3 
>> rb_vm_dispatch + 1331
>> 3   ???  0x000102d5a536 0 + 
>> 4342523190
>> 4   ???  0x000102d63806 0 + 
>> 4342560774
>> 5   libmacruby.dylib 0x000100162d53 rb_vm_run + 
>> 531
>> 6   libmacruby.dylib 0x0001000408f0 
>> ruby_run_node + 80
>> 7   macruby  0x00010d28 main + 152
>> 8   macruby  0x00010c88 start + 52
>> 
>> Thread 1:
>> 0   libSystem.B.dylib0x7fff88fe5f8a 
>> __workq_kernreturn + 10
>> 1   libSystem.B.dylib0x7fff88fe639c 
>> _pthread_wqthread + 917
>> 2   libSystem.B.dylib0x7fff88fe6005 
>> start_wqthread + 13
>> 
>> Thread 0 crashed with X86 Thread State (64-bit):
>> rax: 0x7fff5fbfddc0  rbx: 0x  rcx: 
>> 0x7fff5fbfdf0f  rdx: 0x
>> rdi: 0x0002000bed00  rsi: 0x0002000bec00  rbp: 
>> 0x7fff5fbfdf40  rsp: 0x7fff5fbfdcf8
>> r8: 0x0002   r9: 0x0005  r

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Robert Payne
I did notice I was getting the same error and crash when I was calling 
Objective-C/C methods with blocks that didn't name the parameters in their 
typing such as void(^)(NSInteger) instead of void(^)(NSInteger result) but all 
of Apple's API name the parameters. It could be something else in MacRuby 
though it's hard to say.

What version of Ruby/OS X are you running?

-Robert

On Feb 14, 2011, at 7:16 AM, Jonathan Waddilove wrote:

> OK, thanks for having a look  I thought I'd raise the issue incase it's a 
> bug that needs addressing before 1.0
> 
> I guess it could be something subtle in my environment.
> 
> best wishes, Jonathan
> 
> On 13 Feb 2011, at 18:11, Robert Payne wrote:
> 
>> I just updated to the latest source just to be safe and I'm still not 
>> getting any issues with it... someone else might be able to help.
>> 
>> -Robert
>> 
>> On 14/02/2011, at 7:01 AM, Jonathan Waddilove wrote:
>> 
>>> Hello Robert,
>>> 
>>> Sorry, I must be using the 'other' macirb  ;-) - still doesn't work, here's 
>>> the output
>>> 
>>> JTW:~ jonathan$ macirb
>>> irb(main):001:0> framework "Cocoa"
>>> => true
>>> irb(main):002:0> a = [0,1,2,3,4]
>>> => [0, 1, 2, 3, 4]
>>> irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>> irb(main):004:1>   puts "#{object}"
>>> irb(main):005:0> })
>>> Segmentation fault
>>> JTW:~ jonathan$ 
>>> 
>>> regards,  Jonathan
>>> 
>>> On 13 Feb 2011, at 17:55, Robert Payne wrote:
>>> 
 Hi Jonathan,
 
 Can you try just exactly this in macirb?
 
 framework "Cocoa"
 a = [0,1,2,3,4]
 a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
puts "#{object}"
 })
 
 It's working over here in MacIrb
 On 14/02/2011, at 6:52 AM, Jonathan Waddilove wrote:
 
> Hi Robert, Thanks for the quick response.
> 
> I'm using trunk (installed straight from the MacRuby front page). For 
> what it's worth I have both Xcode3 and Xcode4 installed but can happily 
> reproduce the error in textmate/xcode3/macirb
> 
> regards Jonathan
> 
> On 13 Feb 2011, at 17:31, Robert Payne wrote:
> 
>> Hi Jonathan,
>> 
>> The syntax looks good and it works on my end. Are you using a nightly of 
>> MacRuby or the 0.8 trunk?
>> 
>> a = [0,1,2,3,4]
>> puts "#{a}"
>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>  puts "object: #{object}"
>> })
>> 
>> On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
>> 
>>> Hi, another MacRuby 0.9 question...
>>> 
>>> I've been trying to use lambda and/or Proc.new to provide callback 
>>> blocks (as suggested in Matt's excellent draft book). Again I have seen 
>>> discussions about problems in this area and for me all the suggested 
>>> variants of code fail.
>>> 
>>> Here's a snip of failing code:
>>> 
>>> #!/usr/local/bin/macruby
>>> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: 
>>> #{MACRUBY_VERSION}"
>>> 
>>> a = [1, 2, 3, 4, 5,]
>>> 
>>> a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
>>>   puts "I'll bet this never displays"
>>>   })
>>> 
>>> and here's the resulting crash...
>>> 
>>> Any suggestions?  many thanks,  Jonathan
>>> 
>>> 
>>> Process: macruby [23078]
>>> Path:
>>> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
>>> Identifier:  macruby
>>> Version: ??? (???)
>>> Code Type:   X86-64 (Native)
>>> Parent Process:  ruby [23074]
>>> 
>>> Date/Time:   2011-02-13 16:50:33.806 +
>>> OS Version:  Mac OS X 10.6.6 (10J567)
>>> Report Version:  6
>>> 
>>> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
>>> Exception Codes: KERN_INVALID_ADDRESS at 0x
>>> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
>>> 
>>> Application Specific Information:
>>> objc[23078]: garbage collection is ON
>>> 
>>> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
>>> 0   ??? 00 0 + 0
>>> 1   ??? 0x000102d63ac6 0 + 
>>> 4342561478
>>> 2   libmacruby.dylib0x00010014a0b3 
>>> rb_vm_dispatch + 1331
>>> 3   ??? 0x000102d5a536 0 + 
>>> 4342523190
>>> 4   ??? 0x000102d63806 0 + 
>>> 4342560774
>>> 5   libmacruby.dylib0x000100162d53 rb_vm_run + 
>>> 531
>>> 6   libmacruby.dylib0x0001000408f0 
>>> ruby_run_node + 80
>>> 7   macruby 0x00010d28 main + 152
>>> 8   macruby 0x00010c88 start + 52
>>> 
>>> Thread 1:
>>> 0   libSystem.B.dylib   

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Jonathan Waddilove
I'm on 10.6.6 with MacRuby 0.9

-Jonathan 


On 13 Feb 2011, at 18:18, Robert Payne wrote:

> I did notice I was getting the same error and crash when I was calling 
> Objective-C/C methods with blocks that didn't name the parameters in their 
> typing such as void(^)(NSInteger) instead of void(^)(NSInteger result) but 
> all of Apple's API name the parameters. It could be something else in MacRuby 
> though it's hard to say.
> 
> What version of Ruby/OS X are you running?
> 
> -Robert
> 
> On Feb 14, 2011, at 7:16 AM, Jonathan Waddilove wrote:
> 
>> OK, thanks for having a look  I thought I'd raise the issue incase it's 
>> a bug that needs addressing before 1.0
>> 
>> I guess it could be something subtle in my environment.
>> 
>> best wishes, Jonathan
>> 
>> On 13 Feb 2011, at 18:11, Robert Payne wrote:
>> 
>>> I just updated to the latest source just to be safe and I'm still not 
>>> getting any issues with it... someone else might be able to help.
>>> 
>>> -Robert
>>> 
>>> On 14/02/2011, at 7:01 AM, Jonathan Waddilove wrote:
>>> 
 Hello Robert,
 
 Sorry, I must be using the 'other' macirb  ;-) - still doesn't work, 
 here's the output
 
 JTW:~ jonathan$ macirb
 irb(main):001:0> framework "Cocoa"
 => true
 irb(main):002:0> a = [0,1,2,3,4]
 => [0, 1, 2, 3, 4]
 irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new{|object, index, 
 stop|
 irb(main):004:1>   puts "#{object}"
 irb(main):005:0> })
 Segmentation fault
 JTW:~ jonathan$ 
 
 regards,  Jonathan
 
 On 13 Feb 2011, at 17:55, Robert Payne wrote:
 
> Hi Jonathan,
> 
> Can you try just exactly this in macirb?
> 
> framework "Cocoa"
> a = [0,1,2,3,4]
> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>   puts "#{object}"
> })
> 
> It's working over here in MacIrb
> On 14/02/2011, at 6:52 AM, Jonathan Waddilove wrote:
> 
>> Hi Robert, Thanks for the quick response.
>> 
>> I'm using trunk (installed straight from the MacRuby front page). For 
>> what it's worth I have both Xcode3 and Xcode4 installed but can happily 
>> reproduce the error in textmate/xcode3/macirb
>> 
>> regards Jonathan
>> 
>> On 13 Feb 2011, at 17:31, Robert Payne wrote:
>> 
>>> Hi Jonathan,
>>> 
>>> The syntax looks good and it works on my end. Are you using a nightly 
>>> of MacRuby or the 0.8 trunk?
>>> 
>>> a = [0,1,2,3,4]
>>> puts "#{a}"
>>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>> puts "object: #{object}"
>>> })
>>> 
>>> On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
>>> 
 Hi, another MacRuby 0.9 question...
 
 I've been trying to use lambda and/or Proc.new to provide callback 
 blocks (as suggested in Matt's excellent draft book). Again I have 
 seen discussions about problems in this area and for me all the 
 suggested variants of code fail.
 
 Here's a snip of failing code:
 
 #!/usr/local/bin/macruby
 puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: 
 #{MACRUBY_VERSION}"
 
 a = [1, 2, 3, 4, 5,]
 
 a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
  puts "I'll bet this never displays"
  })

 and here's the resulting crash...
 
 Any suggestions?  many thanks,  Jonathan
 
 
 Process: macruby [23078]
 Path:
 /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
 Identifier:  macruby
 Version: ??? (???)
 Code Type:   X86-64 (Native)
 Parent Process:  ruby [23074]
 
 Date/Time:   2011-02-13 16:50:33.806 +
 OS Version:  Mac OS X 10.6.6 (10J567)
 Report Version:  6
 
 Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
 Exception Codes: KERN_INVALID_ADDRESS at 0x
 Crashed Thread:  0  Dispatch queue: com.apple.main-thread
 
 Application Specific Information:
 objc[23078]: garbage collection is ON
 
 Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
 0   ???00 0 + 0
 1   ???0x000102d63ac6 0 + 
 4342561478
 2   libmacruby.dylib   0x00010014a0b3 
 rb_vm_dispatch + 1331
 3   ???0x000102d5a536 0 + 
 4342523190
 4   ???0x000102d63806 0 + 
 4342560774
 5   libmacruby.dylib   0x000100162d53 rb_vm_run + 
 531
 6   libmacruby.dylib   0x0001000408f0 

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Jordan K. Hubbard
And with the most recent BridgeSupport installed?

On Feb 13, 2011, at 10:53 AM, Jonathan Waddilove wrote:

> I'm on 10.6.6 with MacRuby 0.9
> 
> -Jonathan 
> 
> 
> On 13 Feb 2011, at 18:18, Robert Payne wrote:
> 
>> I did notice I was getting the same error and crash when I was calling 
>> Objective-C/C methods with blocks that didn't name the parameters in their 
>> typing such as void(^)(NSInteger) instead of void(^)(NSInteger result) but 
>> all of Apple's API name the parameters. It could be something else in 
>> MacRuby though it's hard to say.
>> 
>> What version of Ruby/OS X are you running?
>> 
>> -Robert
>> 
>> On Feb 14, 2011, at 7:16 AM, Jonathan Waddilove wrote:
>> 
>>> OK, thanks for having a look  I thought I'd raise the issue incase it's 
>>> a bug that needs addressing before 1.0
>>> 
>>> I guess it could be something subtle in my environment.
>>> 
>>> best wishes, Jonathan
>>> 
>>> On 13 Feb 2011, at 18:11, Robert Payne wrote:
>>> 
 I just updated to the latest source just to be safe and I'm still not 
 getting any issues with it... someone else might be able to help.
 
 -Robert
 
 On 14/02/2011, at 7:01 AM, Jonathan Waddilove wrote:
 
> Hello Robert,
> 
> Sorry, I must be using the 'other' macirb  ;-) - still doesn't work, 
> here's the output
> 
> JTW:~ jonathan$ macirb
> irb(main):001:0> framework "Cocoa"
> => true
> irb(main):002:0> a = [0,1,2,3,4]
> => [0, 1, 2, 3, 4]
> irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new{|object, index, 
> stop|
> irb(main):004:1>   puts "#{object}"
> irb(main):005:0> })
> Segmentation fault
> JTW:~ jonathan$ 
> 
> regards,  Jonathan
> 
> On 13 Feb 2011, at 17:55, Robert Payne wrote:
> 
>> Hi Jonathan,
>> 
>> Can you try just exactly this in macirb?
>> 
>> framework "Cocoa"
>> a = [0,1,2,3,4]
>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>  puts "#{object}"
>> })
>> 
>> It's working over here in MacIrb
>> On 14/02/2011, at 6:52 AM, Jonathan Waddilove wrote:
>> 
>>> Hi Robert, Thanks for the quick response.
>>> 
>>> I'm using trunk (installed straight from the MacRuby front page). For 
>>> what it's worth I have both Xcode3 and Xcode4 installed but can happily 
>>> reproduce the error in textmate/xcode3/macirb
>>> 
>>> regards Jonathan
>>> 
>>> On 13 Feb 2011, at 17:31, Robert Payne wrote:
>>> 
 Hi Jonathan,
 
 The syntax looks good and it works on my end. Are you using a nightly 
 of MacRuby or the 0.8 trunk?
 
 a = [0,1,2,3,4]
 puts "#{a}"
 a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
puts "object: #{object}"
 })
 
 On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
 
> Hi, another MacRuby 0.9 question...
> 
> I've been trying to use lambda and/or Proc.new to provide callback 
> blocks (as suggested in Matt's excellent draft book). Again I have 
> seen discussions about problems in this area and for me all the 
> suggested variants of code fail.
> 
> Here's a snip of failing code:
> 
> #!/usr/local/bin/macruby
> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: 
> #{MACRUBY_VERSION}"
> 
> a = [1, 2, 3, 4, 5,]
> 
> a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
> puts "I'll bet this never displays"
> })
>   
> and here's the resulting crash...
> 
> Any suggestions?  many thanks,  Jonathan
> 
> 
> Process: macruby [23078]
> Path:
> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
> Identifier:  macruby
> Version: ??? (???)
> Code Type:   X86-64 (Native)
> Parent Process:  ruby [23074]
> 
> Date/Time:   2011-02-13 16:50:33.806 +
> OS Version:  Mac OS X 10.6.6 (10J567)
> Report Version:  6
> 
> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
> Exception Codes: KERN_INVALID_ADDRESS at 0x
> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
> 
> Application Specific Information:
> objc[23078]: garbage collection is ON
> 
> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
> 0   ???   00 0 + 0
> 1   ???   0x000102d63ac6 0 + 
> 4342561478
> 2   libmacruby.dylib  0x00010014a0b3 
> rb_vm_dispatch + 1331
> 3   ???   0x000102d5a536 0 + 
> 4342523190
> 4 

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Robert Payne
Yes Bridge Support Preview 3

-Robert

On Feb 14, 2011, at 8:14 AM, Jordan K. Hubbard wrote:

> And with the most recent BridgeSupport installed?
> 
> On Feb 13, 2011, at 10:53 AM, Jonathan Waddilove wrote:
> 
>> I'm on 10.6.6 with MacRuby 0.9
>> 
>> -Jonathan 
>> 
>> 
>> On 13 Feb 2011, at 18:18, Robert Payne wrote:
>> 
>>> I did notice I was getting the same error and crash when I was calling 
>>> Objective-C/C methods with blocks that didn't name the parameters in their 
>>> typing such as void(^)(NSInteger) instead of void(^)(NSInteger result) but 
>>> all of Apple's API name the parameters. It could be something else in 
>>> MacRuby though it's hard to say.
>>> 
>>> What version of Ruby/OS X are you running?
>>> 
>>> -Robert
>>> 
>>> On Feb 14, 2011, at 7:16 AM, Jonathan Waddilove wrote:
>>> 
 OK, thanks for having a look  I thought I'd raise the issue incase 
 it's a bug that needs addressing before 1.0
 
 I guess it could be something subtle in my environment.
 
 best wishes, Jonathan
 
 On 13 Feb 2011, at 18:11, Robert Payne wrote:
 
> I just updated to the latest source just to be safe and I'm still not 
> getting any issues with it... someone else might be able to help.
> 
> -Robert
> 
> On 14/02/2011, at 7:01 AM, Jonathan Waddilove wrote:
> 
>> Hello Robert,
>> 
>> Sorry, I must be using the 'other' macirb  ;-) - still doesn't work, 
>> here's the output
>> 
>> JTW:~ jonathan$ macirb
>> irb(main):001:0> framework "Cocoa"
>> => true
>> irb(main):002:0> a = [0,1,2,3,4]
>> => [0, 1, 2, 3, 4]
>> irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new{|object, index, 
>> stop|
>> irb(main):004:1>   puts "#{object}"
>> irb(main):005:0> })
>> Segmentation fault
>> JTW:~ jonathan$ 
>> 
>> regards,  Jonathan
>> 
>> On 13 Feb 2011, at 17:55, Robert Payne wrote:
>> 
>>> Hi Jonathan,
>>> 
>>> Can you try just exactly this in macirb?
>>> 
>>> framework "Cocoa"
>>> a = [0,1,2,3,4]
>>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>> puts "#{object}"
>>> })
>>> 
>>> It's working over here in MacIrb
>>> On 14/02/2011, at 6:52 AM, Jonathan Waddilove wrote:
>>> 
 Hi Robert, Thanks for the quick response.
 
 I'm using trunk (installed straight from the MacRuby front page). For 
 what it's worth I have both Xcode3 and Xcode4 installed but can 
 happily reproduce the error in textmate/xcode3/macirb
 
 regards Jonathan
 
 On 13 Feb 2011, at 17:31, Robert Payne wrote:
 
> Hi Jonathan,
> 
> The syntax looks good and it works on my end. Are you using a nightly 
> of MacRuby or the 0.8 trunk?
> 
> a = [0,1,2,3,4]
> puts "#{a}"
> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>   puts "object: #{object}"
> })
> 
> On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
> 
>> Hi, another MacRuby 0.9 question...
>> 
>> I've been trying to use lambda and/or Proc.new to provide callback 
>> blocks (as suggested in Matt's excellent draft book). Again I have 
>> seen discussions about problems in this area and for me all the 
>> suggested variants of code fail.
>> 
>> Here's a snip of failing code:
>> 
>> #!/usr/local/bin/macruby
>> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: 
>> #{MACRUBY_VERSION}"
>> 
>> a = [1, 2, 3, 4, 5,]
>> 
>> a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
>>puts "I'll bet this never displays"
>>})
>>  
>> and here's the resulting crash...
>> 
>> Any suggestions?  many thanks,  Jonathan
>> 
>> 
>> Process: macruby [23078]
>> Path:
>> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
>> Identifier:  macruby
>> Version: ??? (???)
>> Code Type:   X86-64 (Native)
>> Parent Process:  ruby [23074]
>> 
>> Date/Time:   2011-02-13 16:50:33.806 +
>> OS Version:  Mac OS X 10.6.6 (10J567)
>> Report Version:  6
>> 
>> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
>> Exception Codes: KERN_INVALID_ADDRESS at 0x
>> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
>> 
>> Application Specific Information:
>> objc[23078]: garbage collection is ON
>> 
>> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
>> 0   ???  00 0 + 0
>> 1   ???  0x000

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Jonathan Waddilove
Just reinstalled xcode 3, MacRuby 0.8 and added BS preview 3 - still have the 
same problem:-(

-Jonathan

On 13 Feb 2011, at 19:14, Jordan K. Hubbard wrote:

> And with the most recent BridgeSupport installed?
> 
> On Feb 13, 2011, at 10:53 AM, Jonathan Waddilove wrote:
> 
>> I'm on 10.6.6 with MacRuby 0.9
>> 
>> -Jonathan 
>> 
>> 
>> On 13 Feb 2011, at 18:18, Robert Payne wrote:
>> 
>>> I did notice I was getting the same error and crash when I was calling 
>>> Objective-C/C methods with blocks that didn't name the parameters in their 
>>> typing such as void(^)(NSInteger) instead of void(^)(NSInteger result) but 
>>> all of Apple's API name the parameters. It could be something else in 
>>> MacRuby though it's hard to say.
>>> 
>>> What version of Ruby/OS X are you running?
>>> 
>>> -Robert
>>> 
>>> On Feb 14, 2011, at 7:16 AM, Jonathan Waddilove wrote:
>>> 
 OK, thanks for having a look  I thought I'd raise the issue incase 
 it's a bug that needs addressing before 1.0
 
 I guess it could be something subtle in my environment.
 
 best wishes, Jonathan
 
 On 13 Feb 2011, at 18:11, Robert Payne wrote:
 
> I just updated to the latest source just to be safe and I'm still not 
> getting any issues with it... someone else might be able to help.
> 
> -Robert
> 
> On 14/02/2011, at 7:01 AM, Jonathan Waddilove wrote:
> 
>> Hello Robert,
>> 
>> Sorry, I must be using the 'other' macirb  ;-) - still doesn't work, 
>> here's the output
>> 
>> JTW:~ jonathan$ macirb
>> irb(main):001:0> framework "Cocoa"
>> => true
>> irb(main):002:0> a = [0,1,2,3,4]
>> => [0, 1, 2, 3, 4]
>> irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new{|object, index, 
>> stop|
>> irb(main):004:1>   puts "#{object}"
>> irb(main):005:0> })
>> Segmentation fault
>> JTW:~ jonathan$ 
>> 
>> regards,  Jonathan
>> 
>> On 13 Feb 2011, at 17:55, Robert Payne wrote:
>> 
>>> Hi Jonathan,
>>> 
>>> Can you try just exactly this in macirb?
>>> 
>>> framework "Cocoa"
>>> a = [0,1,2,3,4]
>>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>> puts "#{object}"
>>> })
>>> 
>>> It's working over here in MacIrb
>>> On 14/02/2011, at 6:52 AM, Jonathan Waddilove wrote:
>>> 
 Hi Robert, Thanks for the quick response.
 
 I'm using trunk (installed straight from the MacRuby front page). For 
 what it's worth I have both Xcode3 and Xcode4 installed but can 
 happily reproduce the error in textmate/xcode3/macirb
 
 regards Jonathan
 
 On 13 Feb 2011, at 17:31, Robert Payne wrote:
 
> Hi Jonathan,
> 
> The syntax looks good and it works on my end. Are you using a nightly 
> of MacRuby or the 0.8 trunk?
> 
> a = [0,1,2,3,4]
> puts "#{a}"
> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>   puts "object: #{object}"
> })
> 
> On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
> 
>> Hi, another MacRuby 0.9 question...
>> 
>> I've been trying to use lambda and/or Proc.new to provide callback 
>> blocks (as suggested in Matt's excellent draft book). Again I have 
>> seen discussions about problems in this area and for me all the 
>> suggested variants of code fail.
>> 
>> Here's a snip of failing code:
>> 
>> #!/usr/local/bin/macruby
>> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: 
>> #{MACRUBY_VERSION}"
>> 
>> a = [1, 2, 3, 4, 5,]
>> 
>> a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
>>puts "I'll bet this never displays"
>>})
>>  
>> and here's the resulting crash...
>> 
>> Any suggestions?  many thanks,  Jonathan
>> 
>> 
>> Process: macruby [23078]
>> Path:
>> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
>> Identifier:  macruby
>> Version: ??? (???)
>> Code Type:   X86-64 (Native)
>> Parent Process:  ruby [23074]
>> 
>> Date/Time:   2011-02-13 16:50:33.806 +
>> OS Version:  Mac OS X 10.6.6 (10J567)
>> Report Version:  6
>> 
>> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
>> Exception Codes: KERN_INVALID_ADDRESS at 0x
>> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
>> 
>> Application Specific Information:
>> objc[23078]: garbage collection is ON
>> 
>> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
>> 0   ???  0

Re: [MacRuby-devel] MacRuby 0.9 - NSDate initWithTimeInterval:sinceDate: problem

2011-02-13 Thread Alan Skipp
I think you've just managed to get your variable names mixed up. You've used 
'cocoaFinishTime' where you should have used 'cocoaTime'

last line should be:
puts "Cocoa Later time: #{cocoaFinishTime}, interval: 
#{cocoaFinishTime.timeIntervalSinceDate(cocoaTime)} seconds"

al


On 13 Feb 2011, at 16:42, Jonathan Waddilove wrote:

> Hi, I have been trying to use the NSDate initWithTimeInterval:sinceDate: 
> method to measure elapsed times.
> 
> I know there has been some discussion about the mapping from Cocoa NSDate to 
> Ruby Time and back but I'm not sure if this is supposed to be working now?
> 
> Here's a snip of code that calculates the interval using Ruby Time and then 
> NSDate
> 
> #!/usr/local/bin/macruby
> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: #{MACRUBY_VERSION}"
> 
> puts "\n\nRuby vesion - works as expected"
> point_in_time = Time.now
> puts "Ruby start time #{point_in_time}"
> sleep(1)
> later_time = Time.now
> puts "Later time: #{later_time}, interval: #{later_time - point_in_time} 
> seconds"
> 
> puts "\n\nFailing Cocoa version"
> cocoaTime = NSDate.date
> puts "Coca start time: #{cocoaTime}"
> sleep(1)
> cocoaFinishTime = NSDate.date
> puts "Cocoa Later time: #{cocoaFinishTime}, interval: 
> #{cocoaFinishTime.timeIntervalSinceDate( cocoaFinishTime)} seconds"
> 
> 
> And here's the output, note the NSDate sees zero intervale...
> Ruby Version: 1.9.2, MacRuby Version: 0.8
> 
> 
> Ruby vesion - works as expected
> Ruby start time 2011-02-13 16:33:23 +
> Later time: 2011-02-13 16:33:24 +, interval: 1.000694 seconds
> 
> 
> Failing Cocoa version
> Coca start time: 2011-02-13 16:33:24 +
> Cocoa Later time: 2011-02-13 16:33:25 +, interval: 0.0 seconds
> 
> User error? or do I need to file a ticket?
> 
> Best wishes and thanks, Jonathan
> 
> ___
> 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 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Jordan K. Hubbard
Dang, that's it for ideas from me.  Just to check all the boxes, when you:

1. Have no signs of Xcode4 on your system but are clearly using Xcode3.
2. Have installed BS Preview 3
3. Have installed MacRuby from -trunk rather than 0.8

The problem persists, yes?

Thanks,

- Jordan

On Feb 13, 2011, at 11:38 AM, Jonathan Waddilove wrote:

> Just reinstalled xcode 3, MacRuby 0.8 and added BS preview 3 - still have the 
> same problem:-(
> 
> -Jonathan
> 
> On 13 Feb 2011, at 19:14, Jordan K. Hubbard wrote:
> 
>> And with the most recent BridgeSupport installed?
>> 
>> On Feb 13, 2011, at 10:53 AM, Jonathan Waddilove wrote:
>> 
>>> I'm on 10.6.6 with MacRuby 0.9
>>> 
>>> -Jonathan 
>>> 
>>> 
>>> On 13 Feb 2011, at 18:18, Robert Payne wrote:
>>> 
 I did notice I was getting the same error and crash when I was calling 
 Objective-C/C methods with blocks that didn't name the parameters in their 
 typing such as void(^)(NSInteger) instead of void(^)(NSInteger result) but 
 all of Apple's API name the parameters. It could be something else in 
 MacRuby though it's hard to say.
 
 What version of Ruby/OS X are you running?
 
 -Robert
 
 On Feb 14, 2011, at 7:16 AM, Jonathan Waddilove wrote:
 
> OK, thanks for having a look  I thought I'd raise the issue incase 
> it's a bug that needs addressing before 1.0
> 
> I guess it could be something subtle in my environment.
> 
> best wishes, Jonathan
> 
> On 13 Feb 2011, at 18:11, Robert Payne wrote:
> 
>> I just updated to the latest source just to be safe and I'm still not 
>> getting any issues with it... someone else might be able to help.
>> 
>> -Robert
>> 
>> On 14/02/2011, at 7:01 AM, Jonathan Waddilove wrote:
>> 
>>> Hello Robert,
>>> 
>>> Sorry, I must be using the 'other' macirb  ;-) - still doesn't work, 
>>> here's the output
>>> 
>>> JTW:~ jonathan$ macirb
>>> irb(main):001:0> framework "Cocoa"
>>> => true
>>> irb(main):002:0> a = [0,1,2,3,4]
>>> => [0, 1, 2, 3, 4]
>>> irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new{|object, index, 
>>> stop|
>>> irb(main):004:1>   puts "#{object}"
>>> irb(main):005:0> })
>>> Segmentation fault
>>> JTW:~ jonathan$ 
>>> 
>>> regards,  Jonathan
>>> 
>>> On 13 Feb 2011, at 17:55, Robert Payne wrote:
>>> 
 Hi Jonathan,
 
 Can you try just exactly this in macirb?
 
 framework "Cocoa"
 a = [0,1,2,3,4]
 a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
puts "#{object}"
 })
 
 It's working over here in MacIrb
 On 14/02/2011, at 6:52 AM, Jonathan Waddilove wrote:
 
> Hi Robert, Thanks for the quick response.
> 
> I'm using trunk (installed straight from the MacRuby front page). For 
> what it's worth I have both Xcode3 and Xcode4 installed but can 
> happily reproduce the error in textmate/xcode3/macirb
> 
> regards Jonathan
> 
> On 13 Feb 2011, at 17:31, Robert Payne wrote:
> 
>> Hi Jonathan,
>> 
>> The syntax looks good and it works on my end. Are you using a 
>> nightly of MacRuby or the 0.8 trunk?
>> 
>> a = [0,1,2,3,4]
>> puts "#{a}"
>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>  puts "object: #{object}"
>> })
>> 
>> On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
>> 
>>> Hi, another MacRuby 0.9 question...
>>> 
>>> I've been trying to use lambda and/or Proc.new to provide callback 
>>> blocks (as suggested in Matt's excellent draft book). Again I have 
>>> seen discussions about problems in this area and for me all the 
>>> suggested variants of code fail.
>>> 
>>> Here's a snip of failing code:
>>> 
>>> #!/usr/local/bin/macruby
>>> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: 
>>> #{MACRUBY_VERSION}"
>>> 
>>> a = [1, 2, 3, 4, 5,]
>>> 
>>> a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
>>>   puts "I'll bet this never displays"
>>>   })
>>> 
>>> and here's the resulting crash...
>>> 
>>> Any suggestions?  many thanks,  Jonathan
>>> 
>>> 
>>> Process: macruby [23078]
>>> Path:
>>> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
>>> Identifier:  macruby
>>> Version: ??? (???)
>>> Code Type:   X86-64 (Native)
>>> Parent Process:  ruby [23074]
>>> 
>>> Date/Time:   2011-02-13 16:50:33.806 +
>>> OS Version:  Mac OS X 10.6.6 (10J567)
>

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Robert Payne
I'm actually experiencing this on my iMac now but it doesn't occur on my 
laptop. 

-Robert

On Feb 14, 2011, at 10:57 AM, Jordan K. Hubbard wrote:

> Dang, that's it for ideas from me.  Just to check all the boxes, when you:
> 
> 1. Have no signs of Xcode4 on your system but are clearly using Xcode3.
> 2. Have installed BS Preview 3
> 3. Have installed MacRuby from -trunk rather than 0.8
> 
> The problem persists, yes?
> 
> Thanks,
> 
> - Jordan
> 
> On Feb 13, 2011, at 11:38 AM, Jonathan Waddilove wrote:
> 
>> Just reinstalled xcode 3, MacRuby 0.8 and added BS preview 3 - still have 
>> the same problem:-(
>> 
>> -Jonathan
>> 
>> On 13 Feb 2011, at 19:14, Jordan K. Hubbard wrote:
>> 
>>> And with the most recent BridgeSupport installed?
>>> 
>>> On Feb 13, 2011, at 10:53 AM, Jonathan Waddilove wrote:
>>> 
 I'm on 10.6.6 with MacRuby 0.9
 
 -Jonathan 
 
 
 On 13 Feb 2011, at 18:18, Robert Payne wrote:
 
> I did notice I was getting the same error and crash when I was calling 
> Objective-C/C methods with blocks that didn't name the parameters in 
> their typing such as void(^)(NSInteger) instead of void(^)(NSInteger 
> result) but all of Apple's API name the parameters. It could be something 
> else in MacRuby though it's hard to say.
> 
> What version of Ruby/OS X are you running?
> 
> -Robert
> 
> On Feb 14, 2011, at 7:16 AM, Jonathan Waddilove wrote:
> 
>> OK, thanks for having a look  I thought I'd raise the issue incase 
>> it's a bug that needs addressing before 1.0
>> 
>> I guess it could be something subtle in my environment.
>> 
>> best wishes, Jonathan
>> 
>> On 13 Feb 2011, at 18:11, Robert Payne wrote:
>> 
>>> I just updated to the latest source just to be safe and I'm still not 
>>> getting any issues with it... someone else might be able to help.
>>> 
>>> -Robert
>>> 
>>> On 14/02/2011, at 7:01 AM, Jonathan Waddilove wrote:
>>> 
 Hello Robert,
 
 Sorry, I must be using the 'other' macirb  ;-) - still doesn't work, 
 here's the output
 
 JTW:~ jonathan$ macirb
 irb(main):001:0> framework "Cocoa"
 => true
 irb(main):002:0> a = [0,1,2,3,4]
 => [0, 1, 2, 3, 4]
 irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new{|object, index, 
 stop|
 irb(main):004:1>   puts "#{object}"
 irb(main):005:0> })
 Segmentation fault
 JTW:~ jonathan$ 
 
 regards,  Jonathan
 
 On 13 Feb 2011, at 17:55, Robert Payne wrote:
 
> Hi Jonathan,
> 
> Can you try just exactly this in macirb?
> 
> framework "Cocoa"
> a = [0,1,2,3,4]
> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>   puts "#{object}"
> })
> 
> It's working over here in MacIrb
> On 14/02/2011, at 6:52 AM, Jonathan Waddilove wrote:
> 
>> Hi Robert, Thanks for the quick response.
>> 
>> I'm using trunk (installed straight from the MacRuby front page). 
>> For what it's worth I have both Xcode3 and Xcode4 installed but can 
>> happily reproduce the error in textmate/xcode3/macirb
>> 
>> regards Jonathan
>> 
>> On 13 Feb 2011, at 17:31, Robert Payne wrote:
>> 
>>> Hi Jonathan,
>>> 
>>> The syntax looks good and it works on my end. Are you using a 
>>> nightly of MacRuby or the 0.8 trunk?
>>> 
>>> a = [0,1,2,3,4]
>>> puts "#{a}"
>>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>> puts "object: #{object}"
>>> })
>>> 
>>> On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
>>> 
 Hi, another MacRuby 0.9 question...
 
 I've been trying to use lambda and/or Proc.new to provide callback 
 blocks (as suggested in Matt's excellent draft book). Again I have 
 seen discussions about problems in this area and for me all the 
 suggested variants of code fail.
 
 Here's a snip of failing code:
 
 #!/usr/local/bin/macruby
 puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: 
 #{MACRUBY_VERSION}"
 
 a = [1, 2, 3, 4, 5,]
 
 a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
  puts "I'll bet this never displays"
  })

 and here's the resulting crash...
 
 Any suggestions?  many thanks,  Jonathan
 
 
 Process: macruby [23078]
 Path:
 /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Matt Aimonetti
That's really odd, can we see the stack trace? My guess is that BridgeSupport 
isn't properly installed.
Can you try to reinstall it (if Jordan's suggestions don't help).

- Matt

Sent from my iPhone

On Feb 13, 2011, at 14:03, Robert Payne  wrote:

> I'm actually experiencing this on my iMac now but it doesn't occur on my 
> laptop. 
> 
> -Robert
> 
> On Feb 14, 2011, at 10:57 AM, Jordan K. Hubbard wrote:
> 
>> Dang, that's it for ideas from me.  Just to check all the boxes, when you:
>> 
>> 1. Have no signs of Xcode4 on your system but are clearly using Xcode3.
>> 2. Have installed BS Preview 3
>> 3. Have installed MacRuby from -trunk rather than 0.8
>> 
>> The problem persists, yes?
>> 
>> Thanks,
>> 
>> - Jordan
>> 
>> On Feb 13, 2011, at 11:38 AM, Jonathan Waddilove wrote:
>> 
>>> Just reinstalled xcode 3, MacRuby 0.8 and added BS preview 3 - still have 
>>> the same problem:-(
>>> 
>>> -Jonathan
>>> 
>>> On 13 Feb 2011, at 19:14, Jordan K. Hubbard wrote:
>>> 
 And with the most recent BridgeSupport installed?
 
 On Feb 13, 2011, at 10:53 AM, Jonathan Waddilove wrote:
 
> I'm on 10.6.6 with MacRuby 0.9
> 
> -Jonathan 
> 
> 
> On 13 Feb 2011, at 18:18, Robert Payne wrote:
> 
>> I did notice I was getting the same error and crash when I was calling 
>> Objective-C/C methods with blocks that didn't name the parameters in 
>> their typing such as void(^)(NSInteger) instead of void(^)(NSInteger 
>> result) but all of Apple's API name the parameters. It could be 
>> something else in MacRuby though it's hard to say.
>> 
>> What version of Ruby/OS X are you running?
>> 
>> -Robert
>> 
>> On Feb 14, 2011, at 7:16 AM, Jonathan Waddilove wrote:
>> 
>>> OK, thanks for having a look  I thought I'd raise the issue incase 
>>> it's a bug that needs addressing before 1.0
>>> 
>>> I guess it could be something subtle in my environment.
>>> 
>>> best wishes, Jonathan
>>> 
>>> On 13 Feb 2011, at 18:11, Robert Payne wrote:
>>> 
 I just updated to the latest source just to be safe and I'm still not 
 getting any issues with it... someone else might be able to help.
 
 -Robert
 
 On 14/02/2011, at 7:01 AM, Jonathan Waddilove wrote:
 
> Hello Robert,
> 
> Sorry, I must be using the 'other' macirb  ;-) - still doesn't work, 
> here's the output
> 
> JTW:~ jonathan$ macirb
> irb(main):001:0> framework "Cocoa"
> => true
> irb(main):002:0> a = [0,1,2,3,4]
> => [0, 1, 2, 3, 4]
> irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new{|object, 
> index, stop|
> irb(main):004:1>   puts "#{object}"
> irb(main):005:0> })
> Segmentation fault
> JTW:~ jonathan$ 
> 
> regards,  Jonathan
> 
> On 13 Feb 2011, at 17:55, Robert Payne wrote:
> 
>> Hi Jonathan,
>> 
>> Can you try just exactly this in macirb?
>> 
>> framework "Cocoa"
>> a = [0,1,2,3,4]
>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>puts "#{object}"
>> })
>> 
>> It's working over here in MacIrb
>> On 14/02/2011, at 6:52 AM, Jonathan Waddilove wrote:
>> 
>>> Hi Robert, Thanks for the quick response.
>>> 
>>> I'm using trunk (installed straight from the MacRuby front page). 
>>> For what it's worth I have both Xcode3 and Xcode4 installed but can 
>>> happily reproduce the error in textmate/xcode3/macirb
>>> 
>>> regards Jonathan
>>> 
>>> On 13 Feb 2011, at 17:31, Robert Payne wrote:
>>> 
 Hi Jonathan,
 
 The syntax looks good and it works on my end. Are you using a 
 nightly of MacRuby or the 0.8 trunk?
 
 a = [0,1,2,3,4]
 puts "#{a}"
 a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
puts "object: #{object}"
 })
 
 On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
 
> Hi, another MacRuby 0.9 question...
> 
> I've been trying to use lambda and/or Proc.new to provide 
> callback blocks (as suggested in Matt's excellent draft book). 
> Again I have seen discussions about problems in this area and for 
> me all the suggested variants of code fail.
> 
> Here's a snip of failing code:
> 
> #!/usr/local/bin/macruby
> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: 
> #{MACRUBY_VERSION}"
> 
> a = [1, 2, 3, 4, 5,]
> 
> a.enumerateObjectsUsingBlock(Proc.new {|obj, inde

Re: [MacRuby-devel] MacRuby 0.9 - crash using Proc.new with NSArray.enumerateObjectsUsingBlock

2011-02-13 Thread Laurent Sansonetti
Hi Jonathan,

Your snippet does not require the Foundation framework. Add the following line 
to your script

framework 'Foundation'

You will also need MacRuby 0.8 and the latest BridgeSupport Preview 3 release. 
Then let us know if you still reproduce the crash. 

The snippet works fine in my environment :(

Laurent

On Feb 13, 2011, at 8:55 AM, Jonathan Waddilove wrote:

> Hi, another MacRuby 0.9 question...
> 
> I've been trying to use lambda and/or Proc.new to provide callback blocks (as 
> suggested in Matt's excellent draft book). Again I have seen discussions 
> about problems in this area and for me all the suggested variants of code 
> fail.
> 
> Here's a snip of failing code:
> 
> #!/usr/local/bin/macruby
> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version: #{MACRUBY_VERSION}"
> 
> a = [1, 2, 3, 4, 5,]
> 
> a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
> puts "I'll bet this never displays"
> })
>   
> and here's the resulting crash...
> 
> Any suggestions?  many thanks,  Jonathan
> 
> 
> Process: macruby [23078]
> Path:
> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
> Identifier:  macruby
> Version: ??? (???)
> Code Type:   X86-64 (Native)
> Parent Process:  ruby [23074]
> 
> Date/Time:   2011-02-13 16:50:33.806 +
> OS Version:  Mac OS X 10.6.6 (10J567)
> Report Version:  6
> 
> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
> Exception Codes: KERN_INVALID_ADDRESS at 0x
> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
> 
> Application Specific Information:
> objc[23078]: garbage collection is ON
> 
> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
> 0   ???   00 0 + 0
> 1   ???   0x000102d63ac6 0 + 4342561478
> 2   libmacruby.dylib  0x00010014a0b3 rb_vm_dispatch + 1331
> 3   ???   0x000102d5a536 0 + 4342523190
> 4   ???   0x000102d63806 0 + 4342560774
> 5   libmacruby.dylib  0x000100162d53 rb_vm_run + 531
> 6   libmacruby.dylib  0x0001000408f0 ruby_run_node + 80
> 7   macruby   0x00010d28 main + 152
> 8   macruby   0x00010c88 start + 52
> 
> Thread 1:
> 0   libSystem.B.dylib 0x7fff88fe5f8a __workq_kernreturn + 
> 10
> 1   libSystem.B.dylib 0x7fff88fe639c _pthread_wqthread + 
> 917
> 2   libSystem.B.dylib 0x7fff88fe6005 start_wqthread + 13
> 
> Thread 0 crashed with X86 Thread State (64-bit):
>  rax: 0x7fff5fbfddc0  rbx: 0x  rcx: 0x7fff5fbfdf0f  
> rdx: 0x
>  rdi: 0x0002000bed00  rsi: 0x0002000bec00  rbp: 0x7fff5fbfdf40  
> rsp: 0x7fff5fbfdcf8
>   r8: 0x0002   r9: 0x0005  r10: 0x0001  
> r11: 0x000100af9000
>  r12: 0x0002000bec00  r13: 0x  r14: 0x0005  
> r15: 0x
>  rip: 0x  rfl: 0x00010246  cr2: 0x
> 
> Binary Images:
>   0x1 -0x10ff7 +macruby ??? (???) 
> <4408616F-9F77-025F-C278-91F945728AB0> /usr/local/bin/macruby
>   0x13000 -0x100a29fd7 +libmacruby.dylib 0.8.0 (compatibility 
> 0.8.0) <8910242D-90F3-32AC-A4CA-99D5C316AEB8> 
> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/libmacruby.dylib
>0x7fff5fc0 - 0x7fff5fc3bdef  dyld 132.1 (???) 
> <486E6C61-1197-CC7C-2197-82CE505102D7> /usr/lib/dyld
>0x7fff801f1000 - 0x7fff802aafff  libsqlite3.dylib 9.6.0 (compatibility 
> 9.0.0) <2C5ED312-E646-9ADE-73A9-6199A2A43150> /usr/lib/libsqlite3.dylib
>0x7fff802ba000 - 0x7fff80478fff  libicucore.A.dylib 40.0.0 
> (compatibility 1.0.0) <781E7B63-2AD0-E9BA-927C-4521DB616D02> 
> /usr/lib/libicucore.A.dylib
>0x7fff809d - 0x7fff80a8dff7  com.apple.CoreServices.OSServices 357 
> (357) <7B22626F-D544-1955-CC53-240F4CACEB4A> 
> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
>0x7fff815d5000 - 0x7fff815ebfef  libbsm.0.dylib ??? (???) 
> <42D3023A-A1F7-4121-6417-FCC6B51B3E90> /usr/lib/libbsm.0.dylib
>0x7fff817b9000 - 0x7fff817bdff7  libmathCommon.A.dylib 315.0.0 
> (compatibility 1.0.0) <95718673-FEEE-B6ED-B127-BCDBDB60D4E5> 
> /usr/lib/system/libmathCommon.A.dylib
>0x7fff81cbb000 - 0x7fff81d05ff7  com.apple.Metadata 10.6.3 (507.15) 
> <5170FCE0-ED6C-2E3E-AB28-1DDE3F628FC5> 
> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
>0x7fff8208d000 - 0x7fff82310ff7  com.apple.Foundation 6.6.4 (751.42) 
>  
> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
>0x7fff82318000 - 0x7fff82340fff  com.apple.Dictionary