[#105450] [Ruby master Feature#18228] Add a `timeout` option to `IO.copy_stream` — "byroot (Jean Boussier)" <noreply@...>
SXNzdWUgIzE4MjI4IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGJ5cm9vdCAoSmVhbiBCb3Vzc2llciku
11 messages
2021/09/27
[ruby-core:105241] [Ruby master Bug#11182] Refinement with alias causes strange behavior
From:
"shugo (Shugo Maeda)" <noreply@...>
Date:
2021-09-14 05:39:55 UTC
List:
ruby-core #105241
Issue #11182 has been updated by shugo (Shugo Maeda).
Status changed from Feedback to Closed
ko1 agreed to keep the current behavior, so I close this issue.
----------------------------------------
Bug #11182: Refinement with alias causes strange behavior
https://bugs.ruby-lang.org/issues/11182#change-93648
* Author: ko1 (Koichi Sasada)
* Status: Closed
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* ruby -v: 2.3dev
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
The following script causes strange behavior.
```ruby
class C
def foo
p "C"
end
end
module M
refine C do
def foo
p "Refiend C"
end
end
end
class D < C
alias bar foo
end
using M
D.new.bar
#=> t.rb:21:in `<main>': undefined method `bar' for #<D:0x29fbf58> (NoMethodError)
```
It seems strange.
Maybe (1) C#foo or (2) M#C#foo should be called. But I'm not sure which is suitable.
Previous versions:
```
ruby 2.0.0p606 (2014-11-28 revision 48636) [i386-mswin32_110]
t.rb:9: warning: Refinements are experimental, and the behavior may change in future versions of Ruby!
"C"
ruby 2.1.5p312 (2015-03-10 revision 49912) [i386-mswin32_110]
"C"
```
---Files--------------------------------
1.PNG (38.7 KB)
2.PNG (43.7 KB)
4.PNG (38.5 KB)
3.PNG (37.9 KB)
alias_affected_by_original_refinement.diff (1.34 KB)
6.PNG (36.6 KB)
7.PNG (40.7 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>