Issue #7842 has been reported by mame (Yusuke Endoh). ---------------------------------------- Bug #7842: An alias of a "prepend"ed method skips the original method when calling super https://bugs.ruby-lang.org/issues/7842 Author: mame (Yusuke Endoh) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: next minor ruby -v: ruby 2.0.0dev (2013-02-13 trunk 39225) [x86_64-linux] Hello, module P def m; puts "P"; super; end end class A def m; puts "A"; end end class B < A def m; puts "B"; end prepend P alias m2 m end B.new.m2 #=> expected: P, B, A #=> actual: P, A Is this intentional? It looks weird to me that calling super of P#m (as m2) skips A#m. -- Yusuke Endoh <mame@tsg.ne.jp>
[ruby-trunk - Bug #7842][Assigned] An alias of a "prepend"ed method skips the original method when c
on 2013-02-13 14:53
[ruby-trunk - Bug #7842] An alias of a "prepend"ed method skips the original method when calling sup
on 2013-02-13 23:29
Issue #7842 has been updated by marcandre (Marc-Andre Lafortune). I agree, this can only be a bug. ---------------------------------------- Bug #7842: An alias of a "prepend"ed method skips the original method when calling super https://bugs.ruby-lang.org/issues/7842#change-36252 Author: mame (Yusuke Endoh) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: next minor ruby -v: ruby 2.0.0dev (2013-02-13 trunk 39225) [x86_64-linux] Hello, module P def m; puts "P"; super; end end class A def m; puts "A"; end end class B < A def m; puts "B"; end prepend P alias m2 m end B.new.m2 #=> expected: P, B, A #=> actual: P, A Is this intentional? It looks weird to me that calling super of P#m (as m2) skips A#m. -- Yusuke Endoh <mame@tsg.ne.jp>
[ruby-trunk - Bug #7842] An alias of a "prepend"ed method skips the original method when calling sup
on 2013-02-14 08:15
Issue #7842 has been updated by nobu (Nobuyoshi Nakada). Rather I expect [B, A] in this case. ---------------------------------------- Bug #7842: An alias of a "prepend"ed method skips the original method when calling super https://bugs.ruby-lang.org/issues/7842#change-36275 Author: mame (Yusuke Endoh) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: next minor ruby -v: ruby 2.0.0dev (2013-02-13 trunk 39225) [x86_64-linux] Hello, module P def m; puts "P"; super; end end class A def m; puts "A"; end end class B < A def m; puts "B"; end prepend P alias m2 m end B.new.m2 #=> expected: P, B, A #=> actual: P, A Is this intentional? It looks weird to me that calling super of P#m (as m2) skips A#m. -- Yusuke Endoh <mame@tsg.ne.jp>
Re: [ruby-trunk - Bug #7842] An alias of a "prepend"ed method skips the original method when calling
on 2013-02-14 08:48
(2013/02/14 16:14), nobu (Nobuyoshi Nakada) wrote: > > Rather I expect [B, A] in this case. +1
Re: [ruby-trunk - Bug #7842] An alias of a "prepend"ed method skips the original method when calling
on 2013-02-14 15:55
> Rather I expect [B, A] in this case.
Fine. I just wanted to point out the weird skipping.
(Actually, I expect nothing for such a code :-)
2013/2/14, SASADA Koichi <ko1@atdot.net>:
[ruby-trunk - Bug #7842] An alias of a "prepend"ed method skips the original method when calling sup
on 2013-02-14 17:01
Issue #7842 has been updated by marcandre (Marc-Andre Lafortune). nobu (Nobuyoshi Nakada) wrote: > Rather I expect [B, A] in this case. You do? There would be no way to safely monkey patch this method without using Prepend! So any 1.9.x library that uses monkey patching like alias_method_chain could be incompatible with prepended classes! I expect: B.instance_method(:m) == B.instance_method(:m2) # => true in rc2, false in trunk, should be true B.new.m2 # => [P, B, A], since they are aliases appart from their name Here is another bug (even more clear) that might be related: B.instance_method(:m).owner # => P in rc2 (ok), B in trunk (not ok) B.instance_method(:m2).owner # => #<B:0x0000010384b418>, should be P I wish I had time to look at it further. ---------------------------------------- Bug #7842: An alias of a "prepend"ed method skips the original method when calling super https://bugs.ruby-lang.org/issues/7842#change-36292 Author: mame (Yusuke Endoh) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: next minor ruby -v: ruby 2.0.0dev (2013-02-13 trunk 39225) [x86_64-linux] Hello, module P def m; puts "P"; super; end end class A def m; puts "A"; end end class B < A def m; puts "B"; end prepend P alias m2 m end B.new.m2 #=> expected: P, B, A #=> actual: P, A Is this intentional? It looks weird to me that calling super of P#m (as m2) skips A#m. -- Yusuke Endoh <mame@tsg.ne.jp>
[ruby-trunk - Bug #7842] An alias of a "prepend"ed method skips the original method when calling sup
on 2013-02-17 15:55
Issue #7842 has been updated by matz (Yukihiro Matsumoto).
I expect:
module P
def m; puts "P"; super; end
end
class A
def m; puts "A"; end
end
class B < A
def m; puts "B"; end
alias m2 m
prepend P
alias m3 m
end
B.new.m2
#=> expected: B, A
B.new.m3
#=> expected: P, B, A
Matz.
----------------------------------------
Bug #7842: An alias of a "prepend"ed method skips the original method
when calling super
https://bugs.ruby-lang.org/issues/7842#change-36443
Author: mame (Yusuke Endoh)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category:
Target version: next minor
ruby -v: ruby 2.0.0dev (2013-02-13 trunk 39225) [x86_64-linux]
Hello,
module P
def m; puts "P"; super; end
end
class A
def m; puts "A"; end
end
class B < A
def m; puts "B"; end
prepend P
alias m2 m
end
B.new.m2
#=> expected: P, B, A
#=> actual: P, A
Is this intentional?
It looks weird to me that calling super of P#m (as m2) skips A#m.
--
Yusuke Endoh <mame@tsg.ne.jp>
Re: [ruby-trunk - Bug #7842] An alias of a "prepend"ed method skips the original method when calling
on 2013-02-17 22:04
I'm sorry, but this ticket confuses me. Why does "A" ever get output, if B#m does not also call super?
[ruby-trunk - Bug #7842] An alias of a "prepend"ed method skips the original method when calling sup
on 2013-02-18 04:22
Issue #7842 has been updated by marcandre (Marc-Andre Lafortune). Category set to core Assignee deleted (matz (Yukihiro Matsumoto)) ---------------------------------------- Bug #7842: An alias of a "prepend"ed method skips the original method when calling super https://bugs.ruby-lang.org/issues/7842#change-36485 Author: mame (Yusuke Endoh) Status: Assigned Priority: Normal Assignee: Category: core Target version: next minor ruby -v: ruby 2.0.0dev (2013-02-13 trunk 39225) [x86_64-linux] Hello, module P def m; puts "P"; super; end end class A def m; puts "A"; end end class B < A def m; puts "B"; end prepend P alias m2 m end B.new.m2 #=> expected: P, B, A #=> actual: P, A Is this intentional? It looks weird to me that calling super of P#m (as m2) skips A#m. -- Yusuke Endoh <mame@tsg.ne.jp>
[ruby-trunk - Bug #7842] An alias of a "prepend"ed method skips the original method when calling sup
on 2013-02-18 04:22
Issue #7842 has been updated by marcandre (Marc-Andre Lafortune). phluid61 (Matthew Kerwin) wrote: > I'm sorry, but this ticket confuses me. Why does "A" ever get output, if > B#m does not also call super? You're right to be confused, there's a missing `super` in the examples that everyone assumed was there. So here's the corrected version: module P def m; puts "P"; super; end end class A def m; puts "A"; end end class B < A def m; puts "B"; super; end alias m2 m prepend P alias m3 m end B.new.m2 #=> expected: B, A B.new.m3 #=> expected: P, B, A ---------------------------------------- Bug #7842: An alias of a "prepend"ed method skips the original method when calling super https://bugs.ruby-lang.org/issues/7842#change-36484 Author: mame (Yusuke Endoh) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: next minor ruby -v: ruby 2.0.0dev (2013-02-13 trunk 39225) [x86_64-linux] Hello, module P def m; puts "P"; super; end end class A def m; puts "A"; end end class B < A def m; puts "B"; end prepend P alias m2 m end B.new.m2 #=> expected: P, B, A #=> actual: P, A Is this intentional? It looks weird to me that calling super of P#m (as m2) skips A#m. -- Yusuke Endoh <mame@tsg.ne.jp>
[ruby-trunk - Bug #7842] An alias of a "prepend"ed method skips the original method when calling sup
on 2013-02-22 00:57
Issue #7842 has been updated by ko1 (Koichi Sasada). Assignee set to nobu (Nobuyoshi Nakada) Target version changed from next minor to 2.1.0 marcandre: why you remove assignee? you mean specification discussion was finished at [ruby-core:52386]#5? I assume the reason and I assign this ticket nobu, the patch monster. ---------------------------------------- Bug #7842: An alias of a "prepend"ed method skips the original method when calling super https://bugs.ruby-lang.org/issues/7842#change-36729 Author: mame (Yusuke Endoh) Status: Assigned Priority: Normal Assignee: nobu (Nobuyoshi Nakada) Category: core Target version: 2.1.0 ruby -v: ruby 2.0.0dev (2013-02-13 trunk 39225) [x86_64-linux] Hello, module P def m; puts "P"; super; end end class A def m; puts "A"; end end class B < A def m; puts "B"; end prepend P alias m2 m end B.new.m2 #=> expected: P, B, A #=> actual: P, A Is this intentional? It looks weird to me that calling super of P#m (as m2) skips A#m. -- Yusuke Endoh <mame@tsg.ne.jp>
[ruby-trunk - Bug #7842] An alias of a "prepend"ed method skips the original method when calling sup
on 2013-02-22 02:46
Issue #7842 has been updated by marcandre (Marc-Andre Lafortune). ko1 (Koichi Sasada) wrote: > marcandre: why you remove assignee? > you mean specification discussion was finished at [ruby-core:52386]#5? > I assume the reason and I assign this ticket nobu, the patch monster. Exactly. ---------------------------------------- Bug #7842: An alias of a "prepend"ed method skips the original method when calling super https://bugs.ruby-lang.org/issues/7842#change-36755 Author: mame (Yusuke Endoh) Status: Assigned Priority: Normal Assignee: nobu (Nobuyoshi Nakada) Category: core Target version: 2.1.0 ruby -v: ruby 2.0.0dev (2013-02-13 trunk 39225) [x86_64-linux] Hello, module P def m; puts "P"; super; end end class A def m; puts "A"; end end class B < A def m; puts "B"; end prepend P alias m2 m end B.new.m2 #=> expected: P, B, A #=> actual: P, A Is this intentional? It looks weird to me that calling super of P#m (as m2) skips A#m. -- Yusuke Endoh <mame@tsg.ne.jp>
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.