Re: Numification of captured match

2005-05-12 Thread Damian Conway
Patrick surmised: So I'm guessing that we're all in agreement that +$/, +$1, and +$ all refer to the numeric value of the string matched, as opposed to what's currently written about their values in the draft...? Yes. The semantics proposed in the draft have proved to be too orthogonal for prac

Re: Numification of captured match

2005-05-12 Thread Patrick R. Michaud
On Thu, May 12, 2005 at 08:10:42PM -0700, Larry Wall wrote: > On Thu, May 12, 2005 at 02:55:36PM -0500, Patrick R. Michaud wrote: > : On Fri, May 13, 2005 at 03:23:20AM +0800, Autrijus Tang wrote: > : > Is it really intended that we get into habit of writing this? > : > > : > if 'localhost:80'

Re: Numification of captured match

2005-05-12 Thread Jonathan Scott Duff
On Thu, May 12, 2005 at 08:10:42PM -0700, Larry Wall wrote: > On Thu, May 12, 2005 at 02:55:36PM -0500, Patrick R. Michaud wrote: > : My suggestion is that a match object in numeric context is the > : same as evaluating its string value in a numeric context. If > : we need a way to find out the nu

Re: character classes in p6 rules

2005-05-12 Thread Larry Wall
On Wed, May 11, 2005 at 08:00:20PM -0500, Patrick R. Michaud wrote: : Somehow I'd like to get rid of those inner angles, so : that we always use <+alpha>, <+digit>, <-sp>, <-punct> to : indicate named character classes, and specify combinations : with constructions like <+alpha+punct-[aeiou]>

Re: C<::> in rules

2005-05-12 Thread Patrick R. Michaud
On Thu, May 12, 2005 at 08:56:39PM -0700, Larry Wall wrote: > On Thu, May 12, 2005 at 09:33:37AM -0500, Patrick R. Michaud wrote: > : Also, A05 proposes incorrect alternatives to the above > : > : /[:w[]foo bar]/# null pattern illegal, use > : /[:w()foo bar]/# null capture illega

Re: C<::> in rules

2005-05-12 Thread Larry Wall
On Thu, May 12, 2005 at 09:33:37AM -0500, Patrick R. Michaud wrote: : Also, A05 proposes incorrect alternatives to the above : : /[:w[]foo bar]/# null pattern illegal, use : /[:w()foo bar]/# null capture illegal, and probably undesirable : /[:w\bfoo bar]/# not exactly the

Re: Numification of captured match

2005-05-12 Thread Larry Wall
On Fri, May 13, 2005 at 02:00:10PM +1000, Damian Conway wrote: : >Actually, it's not clear to me offhand why @1 shouldn't mean $1[] : >and %1 shouldn't mean $1{}. : : It *does*. According to the recent capture semantics document: : :> Note that, outside a rule, C<@1> is simply a shorthand for

Re: Question on "is chomped"

2005-05-12 Thread Larry Wall
On Thu, May 12, 2005 at 02:52:01PM -0400, Joshua Gatcomb wrote: : While E02 states that "is chomped" sets the chomped property of : afilehandle, I didn't find any detailed specifications in any of the : As or Ss. : : So - is "is chomped" always the equivalent of: : : while ( ) { : chomp; : }

Re: Numification of captured match

2005-05-12 Thread Damian Conway
Larry Wall wrote: I think we already said something like that once some number of months ago. +$1 simply has to be the numeric value of the match. Agreed. Anyway, while we could have a method for the .matchcount, +$1[] should work fine too. Yep. Actually, it's not clear to me offhand why @1 sho

Re: Numification of captured match

2005-05-12 Thread Larry Wall
On Thu, May 12, 2005 at 02:55:36PM -0500, Patrick R. Michaud wrote: : On Fri, May 13, 2005 at 03:23:20AM +0800, Autrijus Tang wrote: : > Is it really intended that we get into habit of writing this? : > : > if 'localhost:80' ~~ /^(.+)\:(\d+)$/ { : > my $socket = connect(~$0, +$1); : >

Re: Numification of captured match

2005-05-12 Thread Rob Kinyon
On 5/12/05, Jonathan Scott Duff <[EMAIL PROTECTED]> wrote: > On Thu, May 12, 2005 at 02:55:36PM -0500, Patrick R. Michaud wrote: > > On Fri, May 13, 2005 at 03:23:20AM +0800, Autrijus Tang wrote: > > > Is it really intended that we get into habit of writing this? > > > > > > if 'localhost:80' ~

Re: Numification of captured match

2005-05-12 Thread Jonathan Scott Duff
On Thu, May 12, 2005 at 02:55:36PM -0500, Patrick R. Michaud wrote: > On Fri, May 13, 2005 at 03:23:20AM +0800, Autrijus Tang wrote: > > Is it really intended that we get into habit of writing this? > > > > if 'localhost:80' ~~ /^(.+)\:(\d+)$/ { > > my $socket = connect(~$0, +$1); > >

Re: split /(..)*/, 1234567890

2005-05-12 Thread Autrijus Tang
On Thu, May 12, 2005 at 08:33:40PM -0400, Rick Delaney wrote: > Sorry if I'm getting ahead of the implementation but if it is returning > $0 then shouldn't ref($0) return ::Rule::Result or somesuch? It would > just look like an ::Array::Const if you treat it as such. ...also note that the $0 here

Re: split /(..)*/, 1234567890

2005-05-12 Thread Autrijus Tang
On Thu, May 12, 2005 at 08:33:40PM -0400, Rick Delaney wrote: > On Fri, May 13, 2005 at 04:05:23AM +0800, Autrijus Tang wrote: > > pugs> map { ref $_ } split /(..)*/, 1234567890 > > (::Str, ::Array::Const) > > Sorry if I'm getting ahead of the implementation but if it is returning > $0 the

Re: S29: punt [pwned!]

2005-05-12 Thread Aaron Sherman
On Fri, 2005-05-13 at 12:07 +1200, Sam Vilain wrote: > Rod Adams wrote: > > It looks like I'm going to have to punt on finishing S29. > > On behalf of pugs committers, we will gladly adopt this task, which is in > the pugs repository already at docs/S29draft.pod, as well as having a set > of found

Re: split /(..)*/, 1234567890

2005-05-12 Thread Rick Delaney
On Fri, May 13, 2005 at 04:05:23AM +0800, Autrijus Tang wrote: > > On Thu, May 12, 2005 at 12:01:59PM -0700, Larry Wall wrote: > > > Yes, though I would think of it more generally as > > > > > > ('', $0, '', $0, '', $0, ...) > > > > > > where in this case it just happens to be > > > > > >

Re: C<::> in rules

2005-05-12 Thread Patrick R. Michaud
On Thu, May 12, 2005 at 05:15:55PM -0400, Aaron Sherman wrote: > On Thu, 2005-05-12 at 15:41, Patrick R. Michaud wrote: > > False. In the first case the group is the whole rule. In the second > > case the group would not include the (implied) '.*?' at the start of > > the rule. > > This was a ve

Re: S29: punt [pwned!]

2005-05-12 Thread Sam Vilain
Rod Adams wrote: It looks like I'm going to have to punt on finishing S29. On behalf of pugs committers, we will gladly adopt this task, which is in the pugs repository already at docs/S29draft.pod, as well as having a set of foundation classes that correspond to all these object methods in docs/sr

Re: BEGIN and lexical variables inside subroutines

2005-05-12 Thread Dave Mitchell
On Thu, May 12, 2005 at 09:06:48PM +0100, Benjamin Smith wrote: > sub foo { my $x; BEGIN { $x = 3 }; say $x } > foo; foo; foo; > > Currently in perl5 and pugs this prints "3\n\n\n". > > Should BEGIN blocks be able to modify values in lexical variables that > don't really exist yet? (People ca

Re: C<::> in rules

2005-05-12 Thread Aaron Sherman
On Thu, 2005-05-12 at 15:41, Patrick R. Michaud wrote: > $rule = rx :w / plane ::: (\d+) | train ::: (\w+) | auto ::: (\S+) / ; > $rule = rx :w /[ plane :: (\d+) | train :: (\w+) | auto :: (\S+) ]/ ; > > On Thu, May 12, 2005 at 02:29:24PM -0400, Aaron Sherman wrote: > > On Thu, 2005-05-12

BEGIN and lexical variables inside subroutines

2005-05-12 Thread Benjamin Smith
sub foo { my $x; BEGIN { $x = 3 }; say $x } foo; foo; foo; Currently in perl5 and pugs this prints "3\n\n\n". Should BEGIN blocks be able to modify values in lexical variables that don't really exist yet? (People can use state after all to get a variable which does exist early enough for them

Re: split /(..)*/, 1234567890

2005-05-12 Thread Autrijus Tang
On Thu, May 12, 2005 at 02:56:37PM -0500, Jonathan Scott Duff wrote: > On Thu, May 12, 2005 at 12:01:59PM -0700, Larry Wall wrote: > > Yes, though I would think of it more generally as > > > > ('', $0, '', $0, '', $0, ...) > > > > where in this case it just happens to be > > > > ('', $0)

Re: split /(..)*/, 1234567890

2005-05-12 Thread Jonathan Scott Duff
On Thu, May 12, 2005 at 12:01:59PM -0700, Larry Wall wrote: > On Thu, May 12, 2005 at 12:03:55PM -0500, Jonathan Scott Duff wrote: > : I think that the above split should generate a list like this: > : > : ('', [ '12','34','56','78','90']) > > Yes, though I would think of it more generally as

Re: Numification of captured match

2005-05-12 Thread Patrick R. Michaud
On Fri, May 13, 2005 at 03:23:20AM +0800, Autrijus Tang wrote: > Is it really intended that we get into habit of writing this? > > if 'localhost:80' ~~ /^(.+)\:(\d+)$/ { > my $socket = connect(~$0, +$1); > } > > It looks... weird. :) And it would have to be if 'localhost:80'

Re: C<::> in rules

2005-05-12 Thread Patrick R. Michaud
$rule = rx :w / plane ::: (\d+) | train ::: (\w+) | auto ::: (\S+) / ; $rule = rx :w /[ plane :: (\d+) | train :: (\w+) | auto :: (\S+) ]/ ; On Thu, May 12, 2005 at 02:29:24PM -0400, Aaron Sherman wrote: > On Thu, 2005-05-12 at 13:44, Patrick R. Michaud wrote: > > On Thu, May 12, 2005 at 1

Numification of captured match

2005-05-12 Thread Autrijus Tang
Thit has led to surprising results in Pugs's Net::IRC: if 'localhost:80' ~~ /^(.+)\:(\d+)$/ { my $socket = connect($0, $1); } If $1 is a match object here, and connect() assumes Int on its second argument, then it will connect to port 1, as the match object numifies to 1 (indicati

S29: punt

2005-05-12 Thread Rod Adams
It looks like I'm going to have to punt on finishing S29. I'm finding myself in a perpetual state of either no time to work on it, or when there is time, having insufficient brain power left to properly assimilate everything that needs to be considered to do any of the functions justice. Looking

Re: split /(..)*/, 1234567890

2005-05-12 Thread Larry Wall
On Thu, May 12, 2005 at 12:03:55PM -0500, Jonathan Scott Duff wrote: : I think that the above split should generate a list like this: : : ('', [ '12','34','56','78','90']) Yes, though I would think of it more generally as ('', $0, '', $0, '', $0, ...) where in this case it just happen

Question on "is chomped"

2005-05-12 Thread Joshua Gatcomb
While E02 states that "is chomped" sets the chomped property of afilehandle, I didn't find any detailed specifications in any of the As or Ss. So - is "is chomped" always the equivalent of: while ( ) { chomp; } For instance - you have opened the file rw Or, the idea of having mutator and n

Re: C<::> in rules

2005-05-12 Thread Aaron Sherman
On Thu, 2005-05-12 at 13:44, Patrick R. Michaud wrote: > On Thu, May 12, 2005 at 12:53:46PM -0400, Aaron Sherman wrote: > > > In other words, it acts as though one had written > > > > > > $rule = rx :w / plane ::: (\d+) | train ::: (\w+) | auto ::: (\S+) / ; > > > > > > and not > > > >

Re: C<::> in rules

2005-05-12 Thread Uri Guttman
> "PRM" == Patrick R Michaud <[EMAIL PROTECTED]> writes: PRM> On Thu, May 12, 2005 at 12:33:59PM -0500, Jonathan Scott Duff wrote: >> >> > > /[:w\bfoo bar]/# not exactly the same as above >> > >> > No, I think that's exactly the same. >> >> What does \b mean again? I

Re: split /(..)*/, 1234567890

2005-05-12 Thread Jonathan Scott Duff
On Thu, May 12, 2005 at 01:12:26PM -0400, Uri Guttman wrote: > > "JSD" == Jonathan Scott Duff <[EMAIL PROTECTED]> writes: > > JSD> To bring this back to perl6, autrijus' original query was regarding > > JSD>$ pugs -e 'say join ",", split /(..)*/, 1234567890' > > JSD> which curr

Re: C<::> in rules

2005-05-12 Thread Jonathan Scott Duff
On Thu, May 12, 2005 at 12:48:16PM -0500, Patrick R. Michaud wrote: > On Thu, May 12, 2005 at 12:33:59PM -0500, Jonathan Scott Duff wrote: > > > > > > /[:w\bfoo bar]/# not exactly the same as above > > > > > > No, I think that's exactly the same. > > > > What does \b mean again? I assum

Re: C<::> in rules

2005-05-12 Thread Patrick R. Michaud
On Thu, May 12, 2005 at 12:33:59PM -0500, Jonathan Scott Duff wrote: > > > > /[:w\bfoo bar]/# not exactly the same as above > > > > No, I think that's exactly the same. > > What does \b mean again? I assume it's no longer backspace? For as long as I can remember \b has meant "word boun

Re: C<::> in rules

2005-05-12 Thread Patrick R. Michaud
On Thu, May 12, 2005 at 12:53:46PM -0400, Aaron Sherman wrote: > My take, based on S05: > > > In other words, it acts as though one had written > > > > $rule = rx :w / plane ::: (\d+) | train ::: (\w+) | auto ::: (\S+) / ; > > > > and not > > > > $rule = rx :w /[ plane :: (\d+) | tr

Re: C<::> in rules

2005-05-12 Thread Jonathan Scott Duff
On Thu, May 12, 2005 at 12:53:46PM -0400, Aaron Sherman wrote: > On Thu, 2005-05-12 at 10:33, Patrick R. Michaud wrote: > > Next on my list, S05 says "It is illegal to use :: outside of > > an alternation", but A05 has > > > > /[:w::foo bar]/ > > I can't even figure out what that means. :w t

Re: split /(..)*/, 1234567890

2005-05-12 Thread Jody Belka
On Thu, May 12, 2005 at 06:29:49PM +0200, "TSa (Thomas Sandla?)" wrote: > perl -le 'print join ",", split /(..)/, 112233445566' > ,11,,22,,33,,44,,55,,66 [snipped] > perl -le 'print join ",", split /(..)/, 11223' > ,11,,22,3 > > Am I the only one who finds that inconsistent? Maybe, but it's becau

Re: split /(..)*/, 1234567890

2005-05-12 Thread Uri Guttman
> "JSD" == Jonathan Scott Duff <[EMAIL PROTECTED]> writes: JSD> To bring this back to perl6, autrijus' original query was regarding JSD> $ pugs -e 'say join ",", split /(..)*/, 1234567890' JSD> which currently generates a list of ('','12','34','56','78','90') JSD> In perl5 it would

Re: split /(..)*/, 1234567890

2005-05-12 Thread Jonathan Scott Duff
On Thu, May 12, 2005 at 06:29:49PM +0200, "TSa (Thomas Sandlaß)" wrote: > Autrijus Tang wrote: > >I don't know, I didn't invent that! :-) > > > >$ perl -le 'print join ",", split /(..)/, 123' > >,12,3 > > Hmm, > > perl -le 'print join ",", split /(..)/, 112233445566' > ,11,,22,,33,,44,,55

Re: split /(..)*/, 1234567890

2005-05-12 Thread Aaron Sherman
On Thu, 2005-05-12 at 12:22, David Storrs wrote: > On May 12, 2005, at 11:59 AM, Autrijus Tang wrote: > > On Thu, May 12, 2005 at 04:53:06PM +0200, "TSa (Thomas Sandlaï)" > > wrote: > >> Autrijus Tang wrote: > >> > >>>pugs> split /(..)*/, 1234567890 > >>>('', '12', '34', '56', '78', '90')

Re: C<::> in rules

2005-05-12 Thread Aaron Sherman
My take, based on S05: On Thu, 2005-05-12 at 10:33, Patrick R. Michaud wrote: > I have a couple of questions regarding C< :: > in perl 6 rules. > First, a question of verification -- in > > $rule = rx :w / plane :: (\d+) | train :: (\w+) | auto :: (\S+) / ; > > "travel by plane jet train

Re: split /(..)*/, 1234567890

2005-05-12 Thread David Storrs
On May 12, 2005, at 11:59 AM, Autrijus Tang wrote: On Thu, May 12, 2005 at 04:53:06PM +0200, "TSa (Thomas Sandlaï)" wrote: Autrijus Tang wrote: pugs> split /(..)*/, 1234567890 ('', '12', '34', '56', '78', '90') Is this sane? Why the empty string match at the start? I don't know, I didn't in

Re: split /(..)*/, 1234567890

2005-05-12 Thread TSa (Thomas Sandlaß)
Autrijus Tang wrote: I don't know, I didn't invent that! :-) $ perl -le 'print join ",", split /(..)/, 123' ,12,3 Hmm, perl -le 'print join ",", split /(..)/, 112233445566' ,11,,22,,33,,44,,55,,66 For longer strings it makes every other match an empt string. With the "Positions between char

Re: split /(..)*/, 1234567890

2005-05-12 Thread Autrijus Tang
On Thu, May 12, 2005 at 04:53:06PM +0200, "TSa (Thomas Sandlaï)" wrote: > Autrijus Tang wrote: > >pugs> split /(..)*/, 1234567890 > >('', '12', '34', '56', '78', '90') > > > >Is this sane? > > Why the empty string match at the start? I don't know, I didn't invent that! :-) $ perl -le

Re: split /(..)*/, 1234567890

2005-05-12 Thread TSa (Thomas Sandlaß)
Autrijus Tang wrote: pugs> split /(..)*/, 1234567890 ('', '12', '34', '56', '78', '90') Is this sane? Why the empty string match at the start? -- $TSa == all( none( @Larry ), one( @p6l ))

C<::> in rules

2005-05-12 Thread Patrick R. Michaud
I have a couple of questions regarding C< :: > in perl 6 rules. First, a question of verification -- in $rule = rx :w / plane :: (\d+) | train :: (\w+) | auto :: (\S+) / ; "travel by plane jet train tgv today" ~~ $rule I think the match should fail outright, as opposed to matching "train