[MacRuby-devel] [MacRuby] #674: Shoulda fails because of oddity with block_given?
MacRuby
ruby-noreply at macosforge.org
Tue May 4 06:29:39 PDT 2010
#674: Shoulda fails because of oddity with block_given?
---------------------------------+------------------------------------------
Reporter: marick@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: minor | Milestone:
Component: MacRuby | Keywords:
---------------------------------+------------------------------------------
Comment(by marick@…):
It's more complicated. It seems as if block_given? acts like a local
variable bound within the block, so that it retains its value even when
the block is called at some arbitrary later point. Here's a simpler
example:
{{{
def called(&blk)
$block = blk
end
def should(&blk)
called do
puts "In MRI, you would see true instead of #{block_given?}"
end
end
should do "some block thing" end
$block.call
}}}
1.8.6 produces this:
{{{
1388 $ ruby block_given.rb
In MRI, you would see true instead of true
}}}
instead of this from a recent 0.7:
{{{
1389 $ macruby block_given.rb
In MRI, you would see true instead of false
}}}
--
Ticket URL: <http://www.macruby.org/trac/ticket/674#comment:3>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list