Re: Regex query

2002-09-20 Thread Uri Guttman
SC == Simon Cozens [EMAIL PROTECTED] writes: SC raiddev /dev/md0 SC raid-level 5 SC option value SC option value SC ... SC device /dev/sde1 SC raid-disk 0 i have some

Re: Regex query

2002-09-20 Thread Uri Guttman
SC == Simon Cozens [EMAIL PROTECTED] writes: SC rule comm_eol { sp* comment? sp* \n }; aren't those sp*'s redundant? the first is overlapping with the one at the beginning of comment. SC But comment only matches if there *is* a comment, and there may not SC be, so I want to

Re: Regex query

2002-09-20 Thread Simon Cozens
[EMAIL PROTECTED] (Uri Guttman) writes: actually i just had another thought. you don't need any of the $foo := stuff as the match tree will have it all for you. Yes, but it's nice to be able to access the captured things by name. Or should I be saying things like rule raiddev { comment*

Re: Regex query

2002-09-20 Thread Uri Guttman
SC == Simon Cozens [EMAIL PROTECTED] writes: SC [EMAIL PROTECTED] (Uri Guttman) writes: actually i just had another thought. you don't need any of the $foo := stuff as the match tree will have it all for you. SC Yes, but it's nice to be able to access the captured things by SC

Re: Regex query

2002-09-20 Thread Larry Wall
On 20 Sep 2002, Simon Cozens wrote: : their names. also if you use a scalar to grab something which is in a : quantified outer rule what is put in the var? a ref to a list of the : grabbed things? : : *nod* Something I'd like to know. Yes, in fact any list forced into scalar context will

Re: hotplug regexes, other misc regex questions

2002-09-20 Thread Larry Wall
On Sun, 15 Sep 2002, Steve Fink wrote: : What should this do: : : my $x = the letter x; : print yes if $x =~ /the { $x .= ! } .* !/; Depends. I think it may be necessary for speed and safety reasons to set COW on the string we're matching, so that you're always matching against the

Re: Regex query

2002-09-20 Thread Aaron Sherman
On Fri, 2002-09-20 at 04:14, Larry Wall wrote: On 20 Sep 2002, Simon Cozens wrote: : their names. also if you use a scalar to grab something which is in a : quantified outer rule what is put in the var? a ref to a list of the : grabbed things? : : *nod* Something I'd like to know.

RE: Passing arguments

2002-09-20 Thread Larry Wall
On Thu, 19 Sep 2002, Brent Dax wrote: : Aaron Sherman: : # topicalize: To default to C$_ in a prototype (thus : # acquiring the caller's current topic). : : Well, to topicalize a region of code is actually to specify a different : topic, that is, a different value for $_. For example: : :

Re: Regex query

2002-09-20 Thread Larry Wall
On 20 Sep 2002, Aaron Sherman wrote: : Is that any list as oppopsed to any array? Or is that arrayref in a : numeric context the length of the array? In other words does this do : what I think I think it does? : : $shouldbe3 = (1,2,3) + 0; It's 3, though not for the reason a Perl 5

RE: Passing arguments

2002-09-20 Thread Brent Dax
Larry Wall: # That binds the dynamically surrounding $_ to $x as an # out-of-band parameter. Can also bind to $_ to make it the # current topic. The problem I have with that is this: sub for_trace(*@array, block) { loop($_=0; $_ @array; $_++) {

RE: Passing arguments

2002-09-20 Thread Aaron Sherman
On Fri, 2002-09-20 at 10:36, Larry Wall wrote: On Thu, 19 Sep 2002, Brent Dax wrote: : (An aside: it strikes me that you could use Cgiven as a scoped lexical : alias, i.e. : given $bar - $foo { : print $foo; : } Sure, though it also aliases to $_. Does that mean

Re: Regex query

2002-09-20 Thread Aaron Sherman
On Fri, 2002-09-20 at 10:39, Larry Wall wrote: On 20 Sep 2002, Aaron Sherman wrote: : Is that any list as oppopsed to any array? Or is that arrayref in a : numeric context the length of the array? In other words does this do : what I think I think it does? : : $shouldbe3 = (1,2,3) + 0;

RE: Passing arguments

2002-09-20 Thread Larry Wall
On Fri, 20 Sep 2002, Brent Dax wrote: : Larry Wall: : # That binds the dynamically surrounding $_ to $x as an : # out-of-band parameter. Can also bind to $_ to make it the : # current topic. : : The problem I have with that is this: : : sub for_trace(*@array, block) { :

Re: hotplug regexes, other misc regex questions

2002-09-20 Thread Sean O'Rourke
On Fri, 20 Sep 2002, Larry Wall wrote: But if a fast implementation needs to keep pointers into a string rather than offsets from the beginning, we're asking for core dumps if the string is modified out from under the pointers, or we have to adjust all known pointers any time the string may

RE: Passing arguments

2002-09-20 Thread Larry Wall
On 20 Sep 2002, Aaron Sherman wrote: : On Fri, 2002-09-20 at 10:36, Larry Wall wrote: : On Thu, 19 Sep 2002, Brent Dax wrote: : : : (An aside: it strikes me that you could use Cgiven as a scoped lexical : : alias, i.e. : : given $bar - $foo { : : print $foo; : : } : : Sure,

Re: Regex query

2002-09-20 Thread John Williams
On Fri, 20 Sep 2002, Larry Wall wrote: Yes, in fact any list forced into scalar context will make a ref in Perl 6: $arrayref = (1,2,3); That would seem to obviate the need for brackets to define array references. Is there any case where [1,2,3] would be needed instead of (1,2,3)? Also,

RE: Passing arguments

2002-09-20 Thread Larry Wall
On 20 Sep 2002, Aaron Sherman wrote: : I assumed that's what C//=$_ was. It does have the disadvantage of : looking like variable assignment, though. BTW, latest leaning is toward = rather than //= for parameter defaults, since it can, in fact, be undef if the parameter is supplied, while //=

Re: hotplug regexes, other misc regex questions

2002-09-20 Thread Larry Wall
On Fri, 20 Sep 2002, Sean O'Rourke wrote: : On Fri, 20 Sep 2002, Larry Wall wrote: : But if a fast implementation needs to keep pointers into a string : rather than offsets from the beginning, we're asking for core dumps if : the string is modified out from under the pointers, or we have to :

RE: Passing arguments

2002-09-20 Thread Sean O'Rourke
On Fri, 20 Sep 2002, Larry Wall wrote: The current thinking as of Zurich is that the given passes in separate from the ordinary parameters: sub ($a,$b,$c) is given($x) {...} That binds the dynamically surrounding $_ to $x as an out-of-band parameter. Can also bind to $_ to make it the

Re: Passing arguments

2002-09-20 Thread Angel Faus
Larry said: BTW, latest leaning is toward = rather than //= for parameter defaults, ... Horray! Sorry. Couldn't resist. :-) -angel Simple men are happy with simple presents

Re: Regex query

2002-09-20 Thread Larry Wall
On Fri, 20 Sep 2002, John Williams wrote: : On Fri, 20 Sep 2002, Larry Wall wrote: : : Yes, in fact any list forced into scalar context will make a ref in Perl 6: : : $arrayref = (1,2,3); : : That would seem to obviate the need for brackets to define array : references. Is there any

RE: Passing arguments

2002-09-20 Thread Larry Wall
On Fri, 20 Sep 2002, Sean O'Rourke wrote: : On Fri, 20 Sep 2002, Larry Wall wrote: : The current thinking as of Zurich is that the given passes in : separate from the ordinary parameters: : : sub ($a,$b,$c) is given($x) {...} : : That binds the dynamically surrounding $_ to $x as an

Re: Regex query

2002-09-20 Thread John Williams
On Fri, 20 Sep 2002, Larry Wall wrote: On Fri, 20 Sep 2002, John Williams wrote: : On Fri, 20 Sep 2002, Larry Wall wrote: : : Yes, in fact any list forced into scalar context will make a ref in Perl 6: : : $arrayref = (1,2,3); : : That would seem to obviate the need for brackets

Re: Passing arguments

2002-09-20 Thread Adam D. Lopresto
Personally, I like the looks of sub foo($a, $b is given) { ... } Does this mean that we allow/encourage uses of $_ other than as a default for an optional argument? I think it would be less confusing and error-prone to associate the underscore-aliasing with the parameter $_ will

Re: Regex query

2002-09-20 Thread matt diephouse
John Williams wrote: On Fri, 20 Sep 2002, Larry Wall wrote: On Fri, 20 Sep 2002, John Williams wrote: : On Fri, 20 Sep 2002, Larry Wall wrote: : : Yes, in fact any list forced into scalar context will make a ref in Perl 6: : : $arrayref = (1,2,3); : : That would seem to obviate the

Re: Regex query

2002-09-20 Thread Luke Palmer
I was just thinking that $((1,2,3)) is also the same as [1,2,3], and shorter than scalar(1,2,3). I wonder if you can't just use $(1, 2, 3) to the same effect. I think you can. I was under the impression that the C comma was dying, so that would have to make a list or err. Also, I

possible bugs in Exegesis 5 code for matching patterns

2002-09-20 Thread Tolkin, Steve
Here is a discussion thread of Exegesis 5 http://www.perl.com/pub/a/2002/08/22/exegesis5.html at http://developers.slashdot.org/developers/02/08/23/1232230.shtml?tid=145 But the signal/noise is too low, with side tracks into Monty Python etc. In section Smarter alternatives there is this

Re: Regex query

2002-09-20 Thread Chip Salzenberg
According to Luke Palmer: I think to get Perl5 behavioueaur :), you do this: my @flatL = ( *(1a, 2a), *(1b, 2b) ); Geez, I hope not, because that would imply that in my @v = ( func() ); that func is called in a scalar context. -- Chip Salzenberg - a.k.a. -[EMAIL

RE: Regex query

2002-09-20 Thread David Whipp
Larry wrote: : $shouldbe3 = (1,2,3) + 0; It's 3, though not for the reason a Perl 5 programmer would think. (In Perl 6 it's the length of the anonymous array, not the last value.) This kind of clever magic always makes me nervous: it introduces subtle bug potentials. (7,8,9) == 3 #

Re: Regex query

2002-09-20 Thread Chip Salzenberg
According to David Whipp: (7,8,9) == 3 # true (7,8) == 2 # true (7) == 1 # false () == 0 # true? Hell, yes, why didn't I think of that? This is exactly the same problem that afflicts Python's tuple syntax! Larry, I strongly suggest that making () act in any way like []

Re: Regex query

2002-09-20 Thread Luke Palmer
On Fri, 20 Sep 2002, Chip Salzenberg wrote: According to Luke Palmer: I think to get Perl5 behavioueaur :), you do this: my flatL = ( *(1a, 2a), *(1b, 2b) ); Geez, I hope not, because that would imply that in my v = ( func() ); that func is called in a scalar context.

RE: Regex query

2002-09-20 Thread John Williams
On Fri, 20 Sep 2002, David Whipp wrote: Larry wrote: : $shouldbe3 = (1,2,3) + 0; It's 3, though not for the reason a Perl 5 programmer would think. (In Perl 6 it's the length of the anonymous array, not the last value.) This kind of clever magic always makes me nervous: it

Re: Regex query

2002-09-20 Thread Tanton Gibbs
This kind of clever magic always makes me nervous: it introduces subtle bug potentials. (7,8,9) == 3 # true (7,8) == 2 # true (7) == 1 # false () == 0 # true? I believe the last two cases should be: (7,)== 1 (,) == 0 Because its the perl6

Re: Regex query

2002-09-20 Thread Chip Salzenberg
According to John Williams: I believe the last two cases should be: (7,)== 1 (,) == 0 Gack! It's Python's tuple syntax! Run away! Run away! Seriously, having actually programmed Python for money (no smiley -- it was NOT fun), I can say that this syntactical hack would be a

Re: Regex query

2002-09-20 Thread Jonathan Scott Duff
On Fri, Sep 20, 2002 at 09:02:52PM -0600, John Williams wrote: On Fri, 20 Sep 2002, Tanton Gibbs wrote: If this is the case, then can you also have: (,7) What is its length? Hmm, it's a syntax error in perl5. I'd advocate it continuing to be a syntax error in perl 6. Maybe ()

Re: Regex query

2002-09-20 Thread Jonathan Scott Duff
On Fri, Sep 20, 2002 at 02:17:42PM -0700, David Whipp wrote: Larry wrote: : $shouldbe3 = (1,2,3) + 0; It's 3, though not for the reason a Perl 5 programmer would think. (In Perl 6 it's the length of the anonymous array, not the last value.) This kind of clever magic always makes

Re: Regex query

2002-09-20 Thread Tanton Gibbs
This kind of clever magic always makes me nervous: it introduces subtle bug potentials. (7,8,9) == 3 # true (7,8) == 2 # true (7) == 1 # false Why is this one false? I'd expect it to be true just as the others. (7) == 7 why? Otherwise, we couldn't use parens for

Re: Regex query

2002-09-20 Thread John Williams
On Fri, 20 Sep 2002, Jonathan Scott Duff wrote: But I cannot tell whether (7) is list context or numeric context, Nope, you can't tell without the surrounding context: (7) + 0;# numeric $a = (7); # list (7) == 1; # boolean (same as (7).length == 1)