Issue #6239 has been updated by marcandre (Marc-Andre Lafortune).


Hi Matz

matz (Yukihiro Matsumoto) wrote:
> It's behavior change in 1.9, and we are not going to change the behavior in 1.8 (other than fixing bugs) any more.

Oh, it is?

So you mean that it was a known fact that there was an exceptional case with super and modified rest argument only when that rest argument was empty? And that it was a "feature"? Was there any rationale for that behavior?

I'm not saying the bug must be fixed, as it can be easily circumvented using explicit arguments, but it definitely looks like a bug to me.





----------------------------------------
Bug #6239: super Does Not Pass Modified Rest Args When Originally Empty
https://bugs.ruby-lang.org/issues/6239#change-25551

Author: mudge (Paul Mucur)
Status: Rejected
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: 1.8.7-p358


Given the following code:

    class A
      def a(*args)
        args
      end
    end

    class B < A
      def a(*args)
        args << "foo"

        super
      end
    end

1.8.7-p358> B.new.a("bar")
=> ["bar", "foo"]
1.8.7-p358> B.new.a
=> []

But:

1.9.2-p290> B.new.a("bar")
=> ["bar", "foo"]
1.9.2-p290> B.new.a
=> ["foo"]

The 1.9.2 behaviour is more predictable than 1.8.7, should this be backported or is this expected behaviour?


-- 
http://bugs.ruby-lang.org/