[ruby-core:76126] [Ruby trunk Feature#12079] Loosening the condition for refinement
From:
shugo@...
Date:
2016-06-24 06:22:52 UTC
List:
ruby-core #76126
Issue #12079 has been updated by Shugo Maeda.
Assignee changed from Shugo Maeda to Yukihiro Matsumoto
> I would like to propose to loosen the condition for refinement so that as long as the relevant construction (such as the use of & to provoke Symbol#to_proc or calling of send or __send__) is within the valid scope of refinement, allow the call to the relevant methods.
What do you think, Matz?
----------------------------------------
Feature #12079: Loosening the condition for refinement
https://bugs.ruby-lang.org/issues/12079#change-59330
* Author: Tsuyoshi Sawada
* Status: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
There are a few non-standard ways of calling a method that cannot be used when the relevant method is a refined method:
* a symbol used with `&` as a block via symbol to proc
* a symbol used with `send` or `__send__`
For example, the following will fail:
~~~RUBY
module Foo
refine String
def baz; end
end
end
using Foo
["a", "b", "c"].map(&:baz) # => undefined method error
"a".send(:baz) # => undefined method error
~~~
I would like to propose to loosen the condition for refinement so that as long as the relevant construction (such as the use of `&` to provoke `Symbol#to_proc` or calling of `send` or `__send__`) is within the valid scope of refinement, allow the call to the relevant methods.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>