Named capture-based local variables do not scope correctly ----------------------------------------------------------
Key: JRUBY-5311 URL: http://jira.codehaus.org/browse/JRUBY-5311 Project: JRuby Issue Type: Bug Components: Core Classes/Modules, Parser, Ruby 1.9 Affects Versions: JRuby 1.6 Reporter: Charles Oliver Nutter Assignee: Thomas E Enebo Fix For: JRuby 1.6 Not sure if this is a gap in RubySpec, but the named capture support in JRuby is not scoping its variables correctly: {noformat} ~/projects/jruby ➔ jruby --1.9 -e "def foo; x = nil; 1.times { /(?<x>as)(?<y>df)/ =~ 'asdf'; p x; p y }; p x; end; foo" "as" "df" nil ~/projects/jruby ➔ ruby1.9 -e "def foo; x = nil; 1.times { /(?<x>as)(?<y>df)/ =~ 'asdf'; p x; p y }; p x; end; foo" "as" "df" "as" {noformat} It appears that named capture variables behave just like local variable assignment, where an existing variable is used if present or a new one is created in the current scope if not. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email