* [ruby-core:90253] [Ruby trunk Feature#15373] Proposal: Enable refinements to `#method` and `#instance_method`
[not found] <redmine.issue-15373.20181203084734@ruby-lang.org>
@ 2018-12-03 8:47 ` manga.osyo
2018-12-03 9:20 ` [ruby-core:90254] " shevegen
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: manga.osyo @ 2018-12-03 8:47 UTC (permalink / raw)
To: ruby-core
Issue #15373 has been reported by osyo (manga osyo).
----------------------------------------
Feature #15373: Proposal: Enable refinements to `#method` and `#instance_method`
https://bugs.ruby-lang.org/issues/15373
* Author: osyo (manga osyo)
* Status: Open
* 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/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:90254] [Ruby trunk Feature#15373] Proposal: Enable refinements to `#method` and `#instance_method`
[not found] <redmine.issue-15373.20181203084734@ruby-lang.org>
2018-12-03 8:47 ` [ruby-core:90253] [Ruby trunk Feature#15373] Proposal: Enable refinements to `#method` and `#instance_method` manga.osyo
@ 2018-12-03 9:20 ` shevegen
2018-12-03 11:16 ` [ruby-core:90259] " manga.osyo
2019-12-24 1:39 ` [ruby-core:96446] [Ruby master " nobu
3 siblings, 0 replies; 4+ messages in thread
From: shevegen @ 2018-12-03 9:20 UTC (permalink / raw)
To: ruby-core
Issue #15373 has been updated by shevegen (Robert A. Heiler).
I won't comment on the .: here and not about the first part
of the suggestions here either, but about .source_location
I agree as that would make sense (to me at the least).
Returning something that exists is better than returning
nil in this context. In REPL this can be useful too since
one can e. g. automatically "jump" to the code in question
and modify it (I think pry is doing something like this).
----------------------------------------
Feature #15373: Proposal: Enable refinements to `#method` and `#instance_method`
https://bugs.ruby-lang.org/issues/15373#change-75371
* Author: osyo (manga osyo)
* Status: Open
* 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/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:90259] [Ruby trunk Feature#15373] Proposal: Enable refinements to `#method` and `#instance_method`
[not found] <redmine.issue-15373.20181203084734@ruby-lang.org>
2018-12-03 8:47 ` [ruby-core:90253] [Ruby trunk Feature#15373] Proposal: Enable refinements to `#method` and `#instance_method` manga.osyo
2018-12-03 9:20 ` [ruby-core:90254] " shevegen
@ 2018-12-03 11:16 ` manga.osyo
2019-12-24 1:39 ` [ruby-core:96446] [Ruby master " nobu
3 siblings, 0 replies; 4+ messages in thread
From: manga.osyo @ 2018-12-03 11:16 UTC (permalink / raw)
To: ruby-core
Issue #15373 has been updated by osyo (manga osyo).
Thank you! shevegen :)
----------------------------------------
Feature #15373: Proposal: Enable refinements to `#method` and `#instance_method`
https://bugs.ruby-lang.org/issues/15373#change-75374
* Author: osyo (manga osyo)
* Status: Open
* 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/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:96446] [Ruby master Feature#15373] Proposal: Enable refinements to `#method` and `#instance_method`
[not found] <redmine.issue-15373.20181203084734@ruby-lang.org>
` (2 preceding siblings ...)
2018-12-03 11:16 ` [ruby-core:90259] " manga.osyo
@ 2019-12-24 1:39 ` nobu
3 siblings, 0 replies; 4+ messages in thread
From: nobu @ 2019-12-24 1:39 UTC (permalink / raw)
To: ruby-core
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/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-12-24 1:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-15373.20181203084734@ruby-lang.org>
2018-12-03 8:47 ` [ruby-core:90253] [Ruby trunk Feature#15373] Proposal: Enable refinements to `#method` and `#instance_method` manga.osyo
2018-12-03 9:20 ` [ruby-core:90254] " shevegen
2018-12-03 11:16 ` [ruby-core:90259] " manga.osyo
2019-12-24 1:39 ` [ruby-core:96446] [Ruby master " nobu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).