https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-01-02T10:29:58ZRuby Issue Tracking SystemRuby master - Bug #7643: call to super in define_method in refine results in stack level too deephttps://bugs.ruby-lang.org/issues/7643?journal_id=351762013-01-02T10:29:58Zshugo (Shugo Maeda)
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Feedback</i></li><li><strong>Assignee</strong> set to <i>shugo (Shugo Maeda)</i></li></ul><p>Hi,</p>
<p>beatrichartz (Beat Richartz) wrote:</p>
<blockquote>
<p>When define_method is used within the refine block argument, calls to super will result in a stack level too deep. Definitions with def can call super without problems.</p>
</blockquote>
<p>r38126 is too old. Please try the latest revision, where Module#using is removed.</p>
<p>The following modified program doesn't cause a stack level too deep error in my Ubuntu box (ruby 2.0.0dev (2012-12-29 trunk 38655) [i686-linux]):</p>
<p>require 'refinement'<br>
module A<br>
refine Fixnum do<br>
%i(+ -).each do |m|<br>
define_method m do |other|<br>
super(other)<br>
end<br>
end</p>
<pre><code> def * other
super(other)
end
end
</code></pre>
<p>end</p>
<p>using A</p>
<p>class B<br>
def working<br>
puts 'working'<br>
1 * 1<br>
end</p>
<pre><code>def error
puts 'stack level too deep'
1 + 1
end
</code></pre>
<p>end</p>
<p>puts B.new.working<br>
puts B.new.error</p> Ruby master - Bug #7643: call to super in define_method in refine results in stack level too deephttps://bugs.ruby-lang.org/issues/7643?journal_id=351772013-01-02T10:53:48Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/35177/diff?detail_id=24907">diff</a>)</li></ul> Ruby master - Bug #7643: call to super in define_method in refine results in stack level too deephttps://bugs.ruby-lang.org/issues/7643?journal_id=351802013-01-02T21:47:54Zbeatrichartz (Beat Richartz)beat.richartz@gmail.com
<ul></ul><p>Ok, also working for me here with r38676. Should have checked the new versions before, sorry. Have a nice day!</p> Ruby master - Bug #7643: call to super in define_method in refine results in stack level too deephttps://bugs.ruby-lang.org/issues/7643?journal_id=352432013-01-07T12:09:13Zshugo (Shugo Maeda)
<ul><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Rejected</i></li></ul><p>beatrichartz (Beat Richartz) wrote:</p>
<blockquote>
<p>Ok, also working for me here with r38676. Should have checked the new versions before, sorry. Have a nice day!</p>
</blockquote>
<p>Thanks for your confirmation. So I close this issue.</p>