On Fri, Oct 30, 2009 at 9:53 AM, Matt Jones <
redmine@...> wrote:
> Not sure if this is related or not, but I've run across another very similar issue regarding method(:name).call not being equivalent to calling the method.
>
> Example is here:
http://gist.github.com/221585>
> The net result is more dramatic than in this example; rather than simply calling the wrong method, the call to super fails with 'superclass not found'. But the essential problem is the same - calling B.new.foo produces a different result than B.new.method(:foo).call.
In JRuby, it produces the expected output in both cases:
~/projects/jruby ➔ jruby foo.rb
Overridden foo
Overridden foo
(or at least, I believe this is the behavior you would expect to see)
Ruby versions all seem to do it differently, with only 1.8.6 matching
JRuby's output:
~/projects/jruby ➔ ruby foo.rb
Overridden foo
Overridden foo
~/projects/jruby ➔ ruby1.8.7 foo.rb
Overridden foo
foo.rb:5:in `foo': super: no superclass method `foo' (NoMethodError)
from foo.rb:28:in `call'
from foo.rb:28
~/projects/jruby ➔ ruby1.9 foo.rb
module foo
module foo
The odd results don't make sense to me.
- Charlie