[#62297] Re: [ruby-cvs:52906] nari:r45760 (trunk): * gc.c (gc_after_sweep): suppress unnecessary expanding heap. — Eric Wong <normalperson@...>
[email protected] wrote:
7 messages
2014/05/02
[#62307] Re: [ruby-cvs:52906] nari:r45760 (trunk): * gc.c (gc_after_sweep): suppress unnecessary expanding heap.
— SASADA Koichi <ko1@...>
2014/05/03
(2014/05/03 4:41), Eric Wong wrote:
[#62402] Re: [ruby-cvs:52906] nari:r45760 (trunk): * gc.c (gc_after_sweep): suppress unnecessary expanding heap.
— Eric Wong <normalperson@...>
2014/05/05
SASADA Koichi <[email protected]> wrote:
[#62523] [ruby-trunk - Feature #9632] [PATCH 0/2] speedup IO#close with linked-list from ccan — ko1@...
Issue #9632 has been updated by Koichi Sasada.
3 messages
2014/05/11
[#62556] doxygen (Re: Re: [ruby-trunk - Feature #9632] [PATCH 0/2] speedup IO#close with linked-list from ccan) — Tanaka Akira <akr@...>
2014-05-11 8:50 GMT+09:00 Eric Wong <[email protected]>:
3 messages
2014/05/13
[#62727] [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl — Eric Wong <normalperson@...>
rb_unlink_method_entry may cause old_me to be swept before the new
7 messages
2014/05/24
[#63039] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— SASADA Koichi <ko1@...>
2014/06/10
Hi,
[#63077] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— Eric Wong <normalperson@...>
2014/06/10
SASADA Koichi <[email protected]> wrote:
[#63086] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— SASADA Koichi <ko1@...>
2014/06/11
(2014/06/11 4:47), Eric Wong wrote:
[#63087] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— Eric Wong <normalperson@...>
2014/06/11
SASADA Koichi <[email protected]> wrote:
[#62862] [RFC] README.EXT: document rb_gc_register_mark_object — Eric Wong <normalperson@...>
Any comment on officially supporting this as part of the C API?
5 messages
2014/05/30
[ruby-core:62275] [ruby-trunk - Feature #9781] Feature Proposal: Method#super_method
From:
ruby-core@...
Date:
2014-05-02 02:43:47 UTC
List:
ruby-core #62275
Issue #9781 has been updated by Marc-Andre Lafortune.
Hi,
Ryan Davis wrote:
> Maybe it is just me misunderstanding something... but this doesn't seem that complicated. I don't understand why you'd walk through the ancestors when you just just ask one level up:
For one level, with simple class inheritance, it probably isn't, but throw in a prepended module or two, and the desire to go up more than one level (i.e. `obj.method(:foo).super_method.super_method`) and it's not completely trivial.
If ever we support a module being included more than once in the ancestry chain, then it's actually impossible (unless Method provides a more extensive api to tell where it is in the ancestry chain).
I'm +1 for this feature, although I would favor the shorter name `super`. I don't think it would ever conflict with the keyword, and if it did there is still the same solution as with `class`, i.e. `self.super`.
----------------------------------------
Feature #9781: Feature Proposal: Method#super_method
https://bugs.ruby-lang.org/issues/9781#change-46439
* Author: Richard Schneeman
* Status: Open
* Priority: Normal
* Assignee:
* Category: core
* Target version:
----------------------------------------
When `super` is called in a method the Ruby VM knows how to find the next ancestor that has that method and call it. It is difficult to do this manually, so I propose we expose this information in Method#super_location.
Ruby Method class (http://www.ruby-doc.org/core-2.1.1/Method.html) is returned by calling Object.method and passing in a method name (http://www.ruby-doc.org/core-2.1.1/Object.html#method-i-method). This is useful for debugging:
```ruby
# /tmp/code.rb
class Foo
def bar
end
end
puts Foo.new.method(:bar).source_location
# => ["/tmp/code.rb", 3]
```
The Object#method allows a ruby developer to easily track the source location of the method and makes debugging very easy. However if the code is being invoked by a call to `super` it is difficult to track down:
```ruby
# /tmp/code.rb
class BigFoo
def bar
end
end
class Foo < BigFoo
def bar
super
end
end
```
In this code sample it is easy to find the method definition inside of Foo but it is very difficult in large projects to find what code exactly `super` is calling. This simple example is easy, but it can be hard when there are many ancestors. Currently if I wanted to find this we can inspect ancestors
```ruby
Foo.ancestors[1..-1].map do |ancestor|
next unless ancestor.method_defined?(:bar)
ancestor.instance_method(:bar)
end.compact.first.source_location
```
To make this process simpler I am proposing a method on the Method class that would return the result of `super`
It could be called like this:
```ruby
Foo.new.method(:bar).super_method
```
I believe adding Method#super_method, or exposing this same information somewhere else, could greatly help developers to debug large systems easily.
--
https://bugs.ruby-lang.org/