From: drbrain@...7.net Date: 2014-03-11T23:37:06+00:00 Subject: [ruby-core:61423] [ruby-trunk - Bug #9623] [Open] warning: "named capture conflicts a local variable" does not allow loops with named captures Issue #9623 has been reported by Eric Hodel. ---------------------------------------- Bug #9623: warning: "named capture conflicts a local variable" does not allow loops with named captures https://bugs.ruby-lang.org/issues/9623 * Author: Eric Hodel * Status: Open * Priority: Normal * Assignee: * Category: core * Target version: * ruby -v: ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0] * Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- Given the following example: args = [] remaining = 'a,b,c' begin /(?[^,]*),?(?.*)/ =~ remaining args << token end until remaining.empty? p args Gives a warning with -w: test.rb:6: warning: named capture conflicts a local variable - remaining I'm unsure if the warning is useful here. Reassigning in the loop through the named captures seems clearer than using the regexp globals. -- http://bugs.ruby-lang.org/