C
Charles Oliver Nutter
I posted this to ruby-core and got a somewhat mixed response. I'm
curious what the rest of you might think of this behavior.
-------- Original Message --------
Subject: Bug in Kernel#method objects that call super?
Date: Sat, 07 Jul 2007 05:57:13 +0900
From: Charles Oliver Nutter <[email protected]>
Reply-To: (e-mail address removed)
To: (e-mail address removed)
This seems very wrong to me. Calling through a method object should
behave the same for super as calling directly or calling through an alias:
class Foo
def a; puts 'Foo a'; end
def b; puts 'Foo b'; end
end
class Bar < Foo
def a; puts 'Bar a'; super; end
alias b a
end
Bar.new.a # => "Bar a\nFoo a"
Bar.new.b # => "Bar a\nFoo a"
Bar.new.methodb).call # => "Bar a\nFoo b"
It seems incorrect for method objects to change the behavior of super.
If I super in 'a', I want super's 'a' to be called, without exception.
Can someone confirm this is a bug? In JRuby we always super up the
same-named chain, so this represents an incompatibility.
- Charlie
curious what the rest of you might think of this behavior.
-------- Original Message --------
Subject: Bug in Kernel#method objects that call super?
Date: Sat, 07 Jul 2007 05:57:13 +0900
From: Charles Oliver Nutter <[email protected]>
Reply-To: (e-mail address removed)
To: (e-mail address removed)
This seems very wrong to me. Calling through a method object should
behave the same for super as calling directly or calling through an alias:
class Foo
def a; puts 'Foo a'; end
def b; puts 'Foo b'; end
end
class Bar < Foo
def a; puts 'Bar a'; super; end
alias b a
end
Bar.new.a # => "Bar a\nFoo a"
Bar.new.b # => "Bar a\nFoo a"
Bar.new.methodb).call # => "Bar a\nFoo b"
It seems incorrect for method objects to change the behavior of super.
If I super in 'a', I want super's 'a' to be called, without exception.
Can someone confirm this is a bug? In JRuby we always super up the
same-named chain, so this represents an incompatibility.
- Charlie