Issue #22454 has been updated by Josh Partlow.

Status changed from Accepted to In Topic Branch Pending Review
Target version set to 3.5.0
Affected Puppet version deleted (3.3.0-rc2)
Branch set to https://github.com/puppetlabs/puppet/pull/2123

----------------------------------------
Bug #22454: match variables are only partially shadowed
https://projects.puppetlabs.com/issues/22454#change-101031

* Author: Henrik Lindberg
* Status: In Topic Branch Pending Review
* Priority: Normal
* Assignee: 
* Category: language
* Target version: 3.5.0
* Affected Puppet version: 
* Keywords: language
* Branch: https://github.com/puppetlabs/puppet/pull/2123
----------------------------------------
Match expressions have the side effect of setting `$0`-`$n` numerical variables 
to the matched, and each matched capture. 
As many variables as there are captures are set.

The implementation in scope creates a new ephemeral scope-level for each match 
expression. As an example:

    if 'foobar' =~ /(f)(o)(o)(b)(a)(r)/ and 'foo' =~ /(f)(o)(o)/ {
      notice $4
    }

Outputs "b" since the second match did not have a $4.

This is surprising. The most nested ephemeral scope should be responsible for 
returning all numeric variables (i.e. from the last successful match).

This behavior have been in place for quite some time.


    


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to