Hi Alan,

Ouch, you may have found a bug… can you file a ticket? I will look into it for the upcoming release.

Thanks,
Laurent

On Jan 12, 2011, at 1:03 AM, Alan Skipp wrote:

Hi everyone,
Below is a reduction of a problem I've noticed when using 'enumerateObjectsUsingBlock' from inside a proc. The line which causes trouble is:
[1,2,3].enumerateObjectsUsingBlock( Proc.new { |o, i, s| puts "inner enumeration #{o}" } )

If this line is replaced with:
[1,2,3].each { |e| puts "inner enumeration #{e}" }
Then the code behaves as expected.


framework 'Foundation'

proc = Proc.new do |arg|
  [1,2,3].enumerateObjectsUsingBlock( Proc.new { |o, i, s| puts "inner enumeration #{o}" } )
  puts arg.upcase
end

%w[a b c].enumerateObjectsUsingBlock( Proc.new do |obj, idx, stop|
  proc.call(obj)
end
)

The output is as follows:

inner enumeration 1
inner enumeration 2
inner enumeration 3
A
inner enumeration b
inner enumeration c


The output I would expect is this:

inner enumeration 1
inner enumeration 2
inner enumeration 3
A
inner enumeration 1
inner enumeration 2
inner enumeration 3
B
inner enumeration 1
inner enumeration 2
inner enumeration 3
C


_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel