[ruby-core:77186] [Ruby trunk Feature#11476] Methods defined in Refinements cannot be called via send

From: matz@...
Date: 2016-09-07 07:40:15 UTC
List: ruby-core #77186
Issue #11476 has been updated by Yukihiro Matsumoto.


Accepted.

The current behavior is according to the direct interpretation of the refinement spec. But many people expect `send` to be another form of a method call (including refinement). And now I agree with it.

Matz

----------------------------------------
Feature #11476: Methods defined in Refinements cannot be called via send
https://bugs.ruby-lang.org/issues/11476#change-60401

* Author: Akira Matsuda
* Status: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
~~~
class C end

module M
  refine C do
    def a() p:hello end
    def b() p:world end
  end
end

using M

C.new.a
C.new.send :b
~~~

~~~
% ruby -v t.rb
ruby 2.3.0dev (2015-08-22 trunk 51660) [x86_64-darwin14]
:hello
t.rb:13:in `<main>': undefined method `b' for #<C:0x007f86c9a12af0> (NoMethodError)
~~~



-- 
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>

In This Thread

Prev Next