[MacRuby-devel] [MacRuby] #555: Redefinition of method gives unexpected behavior
MacRuby
ruby-noreply at macosforge.org
Wed Jan 13 08:44:55 PST 2010
#555: Redefinition of method gives unexpected behavior
--------------------------------+-------------------------------------------
Reporter: maccheck@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: major | Milestone: MacRuby 0.5
Component: MacRuby | Keywords:
--------------------------------+-------------------------------------------
When I run following test program with Ruby 1.9.1/1.8.7 and MacRuby 0.5b2
I get an unexpected result:
{{{
class TestClass
def initialize; @a_var = "content"; end
end
a = TestClass.new; puts "a: %s" % a.inspect
class TestClass
def initialize(k); @a_var = k; end
end
b = TestClass.new "valueGiven"; puts "b: %s" % b.inspect
c = TestClass.new; puts "c: %s" % c.inspect
}}}
results in Ruby 1.9.1/1.8.7 with the expected behavior:
{{{
a: #<TestClass:0x100155d50 @a_var="content">
b: #<TestClass:0x100155b20 @a_var="valueGiven">
initTest.rb:13:in `initialize': wrong number of arguments (0 for 1)
(ArgumentError)
from initTest.rb:13:in `new'
from initTest.rb:13
}}}
In MacRuby I get following output:
{{{
a: ##-<TestClass:0x200020b60 @a_var="content">
b: ##-<TestClass:0x2000213e0 @a_var="valueGiven">
c: ##-<TestClass:0x200021820 @a_var="content">
}}}
It seems that {{{#initialize}}} (without arguments) is still floating
around...
--
Ticket URL: <http://www.macruby.org/trac/ticket/555>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list