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