From: Yukihiro Matsumoto Date: 2005-03-16T00:49:01+09:00 Subject: Re: Feature or bug ?? Hi, In message "Re: Feature or bug ??" on Tue, 15 Mar 2005 23:02:03 +0900, Lionel Thiry writes: |> ------8<--------------------8<--------------------8<--------------------8<-------------- |> class C1 |> def initialize( &code ) |> code.call |> end |> end |> |> class C2 < C1 |> def initialize( &block ) |> super |> # @c1 = C1.new |> puts "I went here !" |> end |> end |> |> c2 = C2.new do puts "Damn! This went wrong !" end |> ------8<--------------------8<--------------------8<--------------------8<-------------- |> |> Obviously, the program SHOULDN'T display "Damn! This went wrong !" ... but |> actually it does ! A "super" without any argument nor parentheses would pass all given arguments and a block to the method in the super class. I think you wanted to write: class C2 < C1 def initialize( &block ) super() puts "I went here !" end end Note empty parentheses after the "super". |It's a bug. (or a really surprising feature) It's a feature, which may be surprising for the newbies. matz.