Re: Capture sigil

2006-09-22 Thread Larry Wall
On Thu, Sep 21, 2006 at 10:20:20PM -0700, Jonathan Lang wrote: : Two questions: : : 1. How would the capture sigil affect the use of capture objects as : replacements for perl5's references? I don't see how it would have any effect at all, unless the P5 ref happened to be to a typeglob, or had

Re: Capture sigil

2006-09-22 Thread Jonathan Lang
Larry Wall wrote: Jonathan Lang wrote: : Two questions: : : 1. How would the capture sigil affect the use of capture objects as : replacements for perl5's references? I don't see how it would have any effect at all, unless the P5 ref happened to be to a typeglob, or had both array and hash

Re: Capture sigil

2006-09-22 Thread Larry Wall
On Fri, Sep 22, 2006 at 12:32:27AM -0700, Jonathan Lang wrote: : Larry Wall wrote: : Jonathan Lang wrote: : : Two questions: : : : : 1. How would the capture sigil affect the use of capture objects as : : replacements for perl5's references? : : I don't see how it would have any effect at all,

Re: Capture Literals

2006-09-22 Thread Jonathan Lang
Larry Wall wrote: : This would mean that the rules for capturing are as follows: : : * Capturing something in scalar context: If it is a pair, it is : captured as a named argument; otherwise, it is captured as the : invocant. : : * Capturing something in list context: Pairs are captured as named

Re: Capture sigil

2006-09-22 Thread Jonathan Lang
Larry Wall wrote: You don't need to use | to store a capture any more than you need @ to store an array. Just as $x = @b; @$x; gives you the original array, Huh. I'm not used to this happening. So what would the following code do, and why? my @b = ('foo', 'bar'); my $x =

Re: Capture sigil

2006-09-22 Thread Aaron Sherman
Jonathan Lang wrote: Larry Wall wrote: You don't need to use | to store a capture any more than you need @ to store an array. Just as $x = @b; @$x; gives you the original array, Huh. I'm not used to this happening. So what would the following code do, and why? my @b = ('foo',

Motivation for /alpha+/ set Array not Match?

2006-09-22 Thread Audrey Tang
From S05: If a subrule appears two (or more) times in any branch of a lexical scope (i.e. twice within the same subpattern and alternation), or if the subrule is quantified anywhere within a given scope, then its corresponding hash entry is always assigned an array of CMatch objects rather than

Re: Motivation for /alpha+/ set Array not Match?

2006-09-22 Thread Patrick R. Michaud
On Fri, Sep 22, 2006 at 10:22:52PM +0800, Audrey Tang wrote: Moreover: /foo bar bar foo+/ should set $foo to an Array with two Match elements, the first being a simple match, and the second has multiple positional submatches. The thinking behind the separate treatment is that in a

Re: Motivation for /alpha+/ set Array not Match?

2006-09-22 Thread Flavio S. Glock
2006/9/22, Patrick R. Michaud [EMAIL PROTECTED]: Out of curiosity, why not: /foo bar bar $xyz:=(foo+)/ and then one can easily look at $xyz.from and $xyz.to, as well as get to the arrayed elements? (There are other possibilities as well.) I'm not arguing in favor of or against the

Re: Capture sigil

2006-09-22 Thread Jonathan Lang
Aaron Sherman wrote: IMHO most of the confusion here goes away if capture variables ONLY store parameter-list-like captures, and any other kind of capture should, IMHO, permute itself into such a structure if you try to store it into one. That way, their use is carefully constrained to the