[#69084] [Ruby trunk - Feature #11124] [Open] [PATCH] lib/*: use monotonic clock for timeouts — normalperson@...
Issue #11124 has been reported by Eric Wong.
5 messages
2015/05/06
[#69138] [Ruby trunk - Feature #11136] [PATCH] webrick: avoid fcntl module — nobu@...
Issue #11136 has been updated by Nobuyoshi Nakada.
3 messages
2015/05/12
[#69160] [Ruby trunk - Feature #11146] [PATCH] variable.c: initialize generic_iv_tbl at start — nobu@...
Issue #11146 has been updated by Nobuyoshi Nakada.
4 messages
2015/05/13
[#69175] Re: [Ruby trunk - Feature #11146] [PATCH] variable.c: initialize generic_iv_tbl at start
— Eric Wong <normalperson@...>
2015/05/13
nobu@ruby-lang.org wrote:
[ruby-core:69389] [Ruby trunk - Bug #11182] [Feedback] Refinement with alias causes strange behavior
From:
shugo@...
Date:
2015-05-28 08:03:35 UTC
List:
ruby-core #69389
Issue #11182 has been updated by Shugo Maeda.
File alias_affected_by_original_refinement.diff added
Status changed from Open to Feedback
Assignee changed from Shugo Maeda to Koichi Sasada
Koichi Sasada wrote:
> With model (1), it seems C#foo will be called.
> WIth model (2), it seems M::C#foo will be called.
>
> How about it?
I agree that both models are possible and attached a patch implementing model (2).
However, even in the selector model, alias need not to be affected by refinements of
the original method as implemented in trunk, where alias creates a direct link to
the original method instead of a link to its selector.
I agree with Charles from past discussions.
At least the behavior should not be changed in 2.2.
----------------------------------------
Bug #11182: Refinement with alias causes strange behavior
https://bugs.ruby-lang.org/issues/11182#change-52665
* Author: Koichi Sasada
* Status: Feedback
* Priority: Normal
* Assignee: 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)
--
https://bugs.ruby-lang.org/