https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112016-05-09T14:51:45ZRuby Issue Tracking SystemRuby master - Bug #12359: Named captures "conflict" warning is unnecessary and limits uses of named captureshttps://redmine.ruby-lang.org/issues/12359?journal_id=585382016-05-09T14:51:45Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>See <a href="https://github.com/jruby/jruby/issues/3865" class="external">https://github.com/jruby/jruby/issues/3865</a> for a related issue in JRuby.</p> Ruby master - Bug #12359: Named captures "conflict" warning is unnecessary and limits uses of named captureshttps://redmine.ruby-lang.org/issues/12359?journal_id=585692016-05-10T17:08:11Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>Related Ruby issue: <a href="https://bugs.ruby-lang.org/issues/9623" class="external">https://bugs.ruby-lang.org/issues/9623</a></p>
<p>I think the warning needs to be softened to allow repeat use in literal regexp at the very least.</p> Ruby master - Bug #12359: Named captures "conflict" warning is unnecessary and limits uses of named captureshttps://redmine.ruby-lang.org/issues/12359?journal_id=585702016-05-10T18:44:46Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>I have worked around this for now in JRuby by modifying the warning to <em>only</em> fire if a named capture was previously declared as something other than a named capture.</p>
<p>The commit to JRuby is here: <a href="https://github.com/jruby/jruby/commit/3ebc198860905084231d2a1356ea46718b86f2b0" class="external">https://github.com/jruby/jruby/commit/3ebc198860905084231d2a1356ea46718b86f2b0</a></p>
<p>It resolves the verbose noise issue we had with our date/format implementation.</p>
<p>I propose that the warning should only fire when it is a <em>mixed-use</em> variable, i.e. it is potentially assigned both as a named capture and as a normal local variable.</p>
<p>I'd actually like to get rid of it altogether, but it's really just this mixed-use case that needs a warning.</p> Ruby master - Bug #12359: Named captures "conflict" warning is unnecessary and limits uses of named captureshttps://redmine.ruby-lang.org/issues/12359?journal_id=585752016-05-11T08:19:39ZEregon (Benoit Daloze)
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/9623">Bug #9623</a>: warning: "named capture conflicts a local variable" does not allow loops with named captures</i> added</li></ul> Ruby master - Bug #12359: Named captures "conflict" warning is unnecessary and limits uses of named captureshttps://redmine.ruby-lang.org/issues/12359?journal_id=590412016-06-07T05:54:53Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>Agree.</p>
<p><a href="https://github.com/ruby/ruby/compare/trunk...nobu:bug/12359-no-capture-warnings" class="external">https://github.com/ruby/ruby/compare/trunk...nobu:bug/12359-no-capture-warnings</a></p> Ruby master - Bug #12359: Named captures "conflict" warning is unnecessary and limits uses of named captureshttps://redmine.ruby-lang.org/issues/12359?journal_id=591842016-06-13T09:27:16Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul></ul><p>Accepted.</p>
<p>Matz.</p> Ruby master - Bug #12359: Named captures "conflict" warning is unnecessary and limits uses of named captureshttps://redmine.ruby-lang.org/issues/12359?journal_id=591902016-06-13T11:50:14Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset r55396.</p>
<hr>
<p>parse.y: no named capture conflict warnings</p>
<ul>
<li>parse.y (reg_named_capture_assign_iter): remove named capture<br>
conflict warnings. it is just annoying rather than useful.<br>
<a href="/issues/12359">[ruby-core:75416]</a> [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Named captures "conflict" warning is unnecessary and limits uses of named captures (Closed)" href="https://redmine.ruby-lang.org/issues/12359">#12359</a>]</li>
</ul>