https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112014-01-29T00:50:06ZRuby Issue Tracking SystemRuby master - Feature #9451: Refinements and unary & (to_proc)https://redmine.ruby-lang.org/issues/9451?journal_id=446682014-01-29T00:50:06Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul><li><strong>Assignee</strong> set to <i>shugo (Shugo Maeda)</i></li></ul><p>As <code>#===</code> from <code>case</code> statement and <code>#each</code> from for statement, I think refinement should be effective to methods that called implicitly. Let us discuss about the issue.</p>
<p>Matz.</p> Ruby master - Feature #9451: Refinements and unary & (to_proc)https://redmine.ruby-lang.org/issues/9451?journal_id=446762014-01-29T04:05:22Zshugo (Shugo Maeda)
<ul><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Feature</i></li></ul><p>Yukihiro Matsumoto wrote:</p>
<blockquote>
<p>As <code>#===</code> from <code>case</code> statement and <code>#each</code> from for statement, I think refinement should be effective to methods that called implicitly. Let us discuss about the issue.</p>
</blockquote>
<p>What do you think of other implicit conversions such as <code>to_a</code> called by the splat operator.</p> Ruby master - Feature #9451: Refinements and unary & (to_proc)https://redmine.ruby-lang.org/issues/9451?journal_id=448832014-02-01T23:21:48Zshugo (Shugo Maeda)
<ul><li><strong>Category</strong> set to <i>core</i></li><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> changed from <i>shugo (Shugo Maeda)</i> to <i>matz (Yukihiro Matsumoto)</i></li><li><strong>Target version</strong> set to <i>2.2.0</i></li></ul><p>I'd like to clarify the design policy rather than adding features ad hoc.</p>
<p>All implicit method calls in syntactic constructs should be affected by refinements, right?<br>
Do other implementers, especially JRuby people, accept this policy?</p> Ruby master - Feature #9451: Refinements and unary & (to_proc)https://redmine.ruby-lang.org/issues/9451?journal_id=469772014-05-30T14:46:16Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/46977/diff?detail_id=33893">diff</a>)</li></ul><p>IMHO, splat should be affected by refinements, because there is no intermediate method calls.</p> Ruby master - Feature #9451: Refinements and unary & (to_proc)https://redmine.ruby-lang.org/issues/9451?journal_id=552542015-12-06T03:13:47Zjustcolin (Colin Fulton)
<ul></ul><p>Is there any update on this feature? In Ruby 2.2.3 I still run into a problem where the unary & can not be used when the method was added with a refinement, such as the following:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">module</span> <span class="nn">Example</span>
<span class="n">refine</span> <span class="no">String</span> <span class="k">do</span>
<span class="k">def</span> <span class="nf">pugs</span>
<span class="s2">"Pugs!"</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">using</span> <span class="no">Example</span>
<span class="p">(</span><span class="s1">'a'</span><span class="o">..</span><span class="s1">'z'</span><span class="p">).</span><span class="nf">map</span><span class="p">(</span><span class="o">&</span><span class="ss">:pugs</span><span class="p">)</span>
</code></pre>
<p>I can understand why they currently do not work, but it leads to uglier code.</p>
<p>Cheers!</p> Ruby master - Feature #9451: Refinements and unary & (to_proc)https://redmine.ruby-lang.org/issues/9451?journal_id=554682015-12-11T18:42:37Zjustcolin (Colin Fulton)
<ul></ul><p>Sorry, just saw that <a href="https://bugs.ruby-lang.org/issues/9786" class="external">issue 9786</a> is equivalent to this one and was marked as rejected. Thanks!</p> Ruby master - Feature #9451: Refinements and unary & (to_proc)https://redmine.ruby-lang.org/issues/9451?journal_id=598372016-07-30T01:18:53Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Has duplicate</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/12638">Feature #12638</a>: Symbol#to_proc probable bug (seems not to support refinements)</i> added</li></ul> Ruby master - Feature #9451: Refinements and unary & (to_proc)https://redmine.ruby-lang.org/issues/9451?journal_id=604002016-09-07T07:29:56Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul></ul><p>I now think it's OK to accept this proposal. But I don't know how difficult to implement the issue.</p>
<p>Matz.</p> Ruby master - Feature #9451: Refinements and unary & (to_proc)https://redmine.ruby-lang.org/issues/9451?journal_id=604392016-09-08T06:49:18Zshugo (Shugo Maeda)
<ul><li><strong>Has duplicate</strong> <i><a class="issue tracker-2 status-6 priority-4 priority-default closed" href="/issues/12079">Feature #12079</a>: Loosening the condition for refinement</i> added</li></ul> Ruby master - Feature #9451: Refinements and unary & (to_proc)https://redmine.ruby-lang.org/issues/9451?journal_id=609042016-10-15T05:17:12Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul><p>Applied in changeset r56426.</p>
<hr>
<p>vm_args.c: allow refinements in Symbol proc</p>
<ul>
<li>vm_args.c (refine_sym_proc_call): search and call method with<br>
refinements.</li>
<li>vm_args.c (vm_caller_setup_arg_block): enable refinements when<br>
enabled in the caller. [Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Refinements and unary & (to_proc) (Closed)" href="https://redmine.ruby-lang.org/issues/9451">#9451</a>]</li>
</ul>