[MacRuby] #1037: $_ should store the value of local scope.
MacRuby
ruby-noreply at macosforge.org
Sun Dec 12 07:24:39 PST 2010
#1037: $_ should store the value of local scope.
----------------------------------+-----------------------------------------
Reporter: watson1978@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: major | Milestone:
Component: MacRuby | Keywords:
----------------------------------+-----------------------------------------
A similar issue is "#939 : $1, $2 ... should store the value of local
scope".
Test Script:
{{{
#!ruby
require 'tempfile'
t = Tempfile.new("foo")
t.puts "1"
t.puts "2"
t.puts "3"
t.close
def test(io)
io.gets
p $_
end
io = File.open(t.path)
io.gets
p $_
io.gets
test(io)
p $_
}}}
Result of Ruby 1.9:
{{{
$ ruby19 test.rb
"1\n"
"3\n"
"2\n"
}}}
Result of MacRuby Latest:
{{{
$ macruby test.rb
"1\n"
"3\n"
"3\n"
}}}
--
Ticket URL: <http://www.macruby.org/trac/ticket/1037>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list