[ruby-core:96446] [Ruby master Feature#15373] Proposal: Enable refinements to `#method` and `#instance_method`

[email protected]
Newsgroups gmane.comp.lang.ruby.core
Message-ID <redmine.journal-83370.20191224013912.0b1318c3f6bd168c@ruby-lang.org>
Issue #15373 has been updated by nobu (Nobuyoshi Nakada).


https://docs.google.com/document/u/1/d/1W_wrFsFxxU1MepA6HBpfl-9h-nLD8EBsgMsS7yTDvHE/pub

----------------------------------------
Feature #15373: Proposal: Enable refinements to `#method` and `#instance_method`
https://bugs.ruby-lang.org/issues/15373#change-83370

* Author: osyo (manga osyo)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Proposal enable refinements to `#method` and `#instance_method`.
It can be used in the following cases.

```ruby
# default call to #pp
module P2PP
  refine Kernel do
    def p obj
      pp obj
    end
  end
end

using P2PP

# call to Kernel.#pp
[1, 2, 3].map(&method(:p))
```

Also, when checking the defined position as follows, the `refine` place is reflected.


```ruby
module P2PP
  refine Kernel do
    def p obj
      pp obj
    end
  end
end

# Output to refine defined position
# Before
p method(:p).source_location
# => nil
p Kernel.instance_method(:p).source_location
# => nil

using P2PP

# After
p method(:p).source_location
# => ["../ruby/test.rb", 4]
p Kernel.instance_method(:p).source_location
# => ["../ruby/test.rb", 4]
```

I want `.:` operators to work.
https://bugs.ruby-lang.org/issues/13581

pull reqiest: https://github.com/ruby/ruby/pull/2034





-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.