https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112012-11-21T22:53:37ZRuby Issue Tracking SystemRuby master - Feature #7418: Kernel#used_refinementshttps://bugs.ruby-lang.org/issues/7418?journal_id=333972012-11-21T22:53:37Zjudofyr (Magnus Holm)judofyr@gmail.com
<ul></ul><p>Maybe it should be called Module.refinements (a la Module.nesting).</p>
<p>// Magnus Holm</p>
<p>On Wed, Nov 21, 2012 at 12:16 PM, charliesome (Charlie Somerville)<br>
<a href="mailto:charlie@charliesomerville.com" class="email">charlie@charliesomerville.com</a> wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Kernel#used_refinements (Closed)" href="https://bugs.ruby-lang.org/issues/7418">#7418</a> has been reported by charliesome (Charlie Somerville).</p>
<hr>
<p>Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Kernel#used_refinements (Closed)" href="https://bugs.ruby-lang.org/issues/7418">#7418</a>: Kernel#used_refinements<br>
<a href="https://bugs.ruby-lang.org/issues/7418" class="external">https://bugs.ruby-lang.org/issues/7418</a></p>
<p>Author: charliesome (Charlie Somerville)<br>
Status: Open<br>
Priority: Normal<br>
Assignee:<br>
Category:<br>
Target version:</p>
<p>I'd like to propose a method that returns an array of all refinements visible from the current scope. I have documented the ordering of the return array as undefined to allow a bit of flexibility in how it is implemented across the various Ruby implementations.</p>
<p>One of the criticisms of refinements is that its use makes code harder to understand - especially when non-lexical refinements are being used. This method slightly improves the situation by making debugging of code using refinements easier.</p>
<p>I've named the method 'used_refinements' for now, but I'm open to changing that to something else.</p>
<p>I've already done the initial implementation which is attached as a patch. Feedback would be most appreciated.</p>
<p>--<br>
<a href="http://bugs.ruby-lang.org/" class="external">http://bugs.ruby-lang.org/</a></p>
</blockquote> Ruby master - Feature #7418: Kernel#used_refinementshttps://bugs.ruby-lang.org/issues/7418?journal_id=334622012-11-22T13:23:05Zshugo (Shugo Maeda)
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>shugo (Shugo Maeda)</i></li></ul><p>judofyr (Magnus Holm) wrote:</p>
<blockquote>
<p>Maybe it should be called Module.refinements (a la Module.nesting).</p>
</blockquote>
<p>Module.refinements conflicts with Module#refinements, which returns refinements defined in the receiver.</p> Ruby master - Feature #7418: Kernel#used_refinementshttps://bugs.ruby-lang.org/issues/7418?journal_id=335082012-11-22T15:51:32Zchendo (Jack Chen)ruby-lang@chen.do
<ul></ul><p>+1 since I gave Charlie the idea :)</p> Ruby master - Feature #7418: Kernel#used_refinementshttps://bugs.ruby-lang.org/issues/7418?journal_id=337522012-11-24T11:51:38Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Target version</strong> set to <i>2.6</i></li></ul><p>Shugo, is this feature mandatory for the 2.0.0 refinements?<br>
I'm setting to next minor tentatively.</p>
<p>--<br>
Yusuke Endoh <a href="mailto:mame@tsg.ne.jp" class="email">mame@tsg.ne.jp</a></p> Ruby master - Feature #7418: Kernel#used_refinementshttps://bugs.ruby-lang.org/issues/7418?journal_id=402542013-07-02T17:32:14Zshugo (Shugo Maeda)
<ul><li><strong>Assignee</strong> changed from <i>shugo (Shugo Maeda)</i> to <i>matz (Yukihiro Matsumoto)</i></li></ul><p>I'm against adding a new reflection API for refinements into Ruby 2.1.<br>
What do you think of it, Matz?</p> Ruby master - Feature #7418: Kernel#used_refinementshttps://bugs.ruby-lang.org/issues/7418?journal_id=603982016-09-07T07:14:36Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul></ul><p><code>Module.used_refinements</code> accepted.</p>
<p>Matz.</p> Ruby master - Feature #7418: Kernel#used_refinementshttps://bugs.ruby-lang.org/issues/7418?journal_id=604282016-09-07T16:15:50Zshugo (Shugo Maeda)
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul><p>Applied in changeset r56094.</p>
<hr>
<ul>
<li>eval.c (rb_mod_s_used_refinements): new method<br>
Module.used_refinements. based on the patch by Charlie<br>
Somerville. [Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Kernel#used_refinements (Closed)" href="https://bugs.ruby-lang.org/issues/7418">#7418</a>] <a href="/issues/7418">[ruby-core:49805]</a></li>
</ul> Ruby master - Feature #7418: Kernel#used_refinementshttps://bugs.ruby-lang.org/issues/7418?journal_id=604342016-09-08T05:18:58Zshugo (Shugo Maeda)
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Open</i></li></ul><blockquote>
<p>Module.used_refinements accepted.</p>
</blockquote>
<p><code>Module.used_modules</code> might be a better name, because a module can have more than one refinement:</p>
<pre><code>module M
refine A
end
refine B
end
end
using M
p Module.used_modules #=> [M]
</code></pre> Ruby master - Feature #7418: Kernel#used_refinementshttps://bugs.ruby-lang.org/issues/7418?journal_id=604432016-09-08T07:42:44Zshugo (Shugo Maeda)
<ul></ul><p>Shugo Maeda wrote:</p>
<blockquote>
<p><code>Module.used_modules</code> might be a better name, because a module can have more than one refinement:</p>
</blockquote>
<p>Matz said that he thinks so too at <a href="https://twitter.com/yukihiro_matz/status/773787246990196736" class="external">https://twitter.com/yukihiro_matz/status/773787246990196736</a>, so I'll change the name.</p> Ruby master - Feature #7418: Kernel#used_refinementshttps://bugs.ruby-lang.org/issues/7418?journal_id=604452016-09-08T07:49:07Zshugo (Shugo Maeda)
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset r56109.</p>
<hr>
<ul>
<li>eval.c (rb_mod_s_used_modules): rename Module.used_refinements to<br>
Module.used_modules. [Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Kernel#used_refinements (Closed)" href="https://bugs.ruby-lang.org/issues/7418">#7418</a>] <a href="/issues/7418">[ruby-core:49805]</a></li>
</ul>