[ruby-core:32932] Behavior of initialize in 1.9

From: Aaron Patterson <aaron@...>
Date: 2010-10-28 11:12:42 UTC
List: ruby-core #32932
The behavior of initialize in 1.9 seems to have changed.  Here is an irb
sample from 1.8 and 1.9 to illustrate the difference:

>> RUBY_VERSION
=> "1.8.7"
>> class Foo; end
=> nil
>> Foo.new(:a)
ArgumentError: wrong number of arguments (1 for 0)
        from (irb):3:in `initialize'
        from (irb):3:in `new'
        from (irb):3
>>

irb(main):001:0> RUBY_VERSION
=> "1.9.3"
irb(main):002:0> class Foo; end
=> nil
irb(main):003:0> Foo.new(:a)
=> #<Foo:0x0000010102c2c0>
irb(main):004:0>

Is this change intentional?  If so, why?  If you're testing first during
development, this behavior seems surprising to me.

-- 
Aaron Patterson
http://tenderlovemaking.com/

In This Thread

Prev Next