Hi,

In message "Re: Feature or bug ??"
    on Tue, 15 Mar 2005 23:02:03 +0900, Lionel Thiry <lthiryidontwantspam / skynetnospam.be> 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.