On Aug 23, 2006, at 12:43 PM, ts wrote:

>>>>>> "M" == Morton Goldberg <m_goldberg / ameritech.net> writes:
>
> M>  From which I conclude that 'super.another' is parsed as 'super
> M> nil.another'
>
>  No, not really
>
>  super call Parent#something which return nil (the result of #puts)
>  ruby use the result of super (i.e. nil) to call #another
>  because nil don't respond to #another, it give an error

You're right. I forgot to take into account that every Ruby method  
returns an object which cam be the receiver any following message.  
It's all much clearer when I change the test code to:

<code>
#! /usr/bin/ruby -w

class Parent

    def something
    	puts "Parent something"
    	self
    end

    def another
       puts "Parent another"
       self
    end

end

class Child < Parent

    def something
       puts "Child something"
    	super.another
    end

    def another
    	puts "Child another"
    end

end

Child.new.something
</code>

<result>
Child something
Parent something
Child another
</result>

A more correct conclusion would have been that Ruby's 'super' should  
be regarded more as a method call rather than as a pseudo-variable  
(such as 'self'). This is quite different than the 'super' of  
Smalltalk and other object-oriented languages I have past experience  
with.  Do you think Ruby's semantics for 'super' should be regarded  
as an idiosyncrasy or as an advance over Smalltalk's?

Regards, Morton