Re: rule, rx and sub

2002-08-30 Thread Damian Conway
Larry wrote: sub while (test is rx/expr/, body); or some such. That probably isn't sufficient to pick expr out of Perl's grammar rather than the current lexical scope. I love the idea, but the property name needs to be more expressive (and Huffmanly longer). Maybe: sub

Re: backtracking into { code }

2002-08-30 Thread Damian Conway
Ken Fox wrote: A question: Do rules matched in a { code } block set backtrack points for the outer rule? I don't believe so. From A5: A pattern nested within a closure is classified as its own rule, however, so it never gets the chance to pass out of a {...} closure.

declaring if and while (was: rule, rx and sub)

2002-08-30 Thread Thomas A. Boyer
Larry Wall wrote: : In summary: assuming Perl 6 allows user-defined while-ish structures, how : would it be done? I think the secret is to allow easy attachment of regex rules to sub and parameter declarations. There's little point in re-inventing regex syntax using declarations. The

Re: rule, rx and sub

2002-08-30 Thread Trey Harris
In a message dated Thu, 29 Aug 2002, Damian Conway writes: And, of course, the Cis valued property would smart-match its value against the corrresponding argument, so one could also code optimized variants like: sub repeat is multi ($desc is valued(1), body) { body(1);

prebinding questions

2002-08-30 Thread HellyerP
[apologies to anyone who received this twice... the bonehead at the keyboard left the subject blank. grin] This week I was fortunate enough to hear Damian speak twice, once on everything and once on Perl6. Damian, it was tremendous of you to come and speak to us in London - thank-you very

Re: backtracking into { code }

2002-08-30 Thread Ken Fox
Damian Conway wrote: rule expr1 { term { m:cont/operators/ or fail } term } Backtracking would just step back over the rule as if it were atomic (or followed by a colon). Ok, thanks. (The followed by a colon is just to explain the behavior, right? It's illegal to follow a

Re: backtracking into { code }

2002-08-30 Thread Aaron Sherman
[NOTE: BCCing off-list to protect private email addresses] On Fri, 2002-08-30 at 09:07, Ken Fox wrote: Does the following example backtrack into foo? rule foo { b+ } rule bar { a foo b } This was the bit that got me on-board. I did not see the need for backtracking into rules until

Re: backtracking into { code }

2002-08-30 Thread Larry Wall
On Fri, 30 Aug 2002, Ken Fox wrote: : Ok, thanks. (The followed by a colon is just to explain the behavior, : right? It's illegal to follow a code block with a colon, isn't it?) I don't see why it should be illegal--it could be useful if the closure has played continuation games of some sort to

Re: backtracking into { code }

2002-08-30 Thread Ken Fox
Larry Wall wrote: On Fri, 30 Aug 2002, Ken Fox wrote: : Ok, thanks. (The followed by a colon is just to explain the behavior, : right? It's illegal to follow a code block with a colon, isn't it?) I don't see why it should be illegal--it could be useful if the closure has played

Re: backtracking into { code }

2002-08-30 Thread Larry Wall
On Fri, 30 Aug 2002, Ken Fox wrote: : Apoc 5 has It is an error to use : on any atom that does no : backtracking. Code blocks don't backtrack (at least that's what : I understood Damian to say). Code blocks don't backtrack *by default*. But you can do anything in a closure. : Are zero width

Re: backtracking into { code }

2002-08-30 Thread Ken Fox
Larry Wall wrote: There's a famous book called Golf is Not a Game of Perfect. Well now I'm *totally* confused. I looked that up on Amazon and it has something to do with clubs and grass and stuff. That's completely different than what I thought golfing was. ;) Seriously, though. I have a

subroutine parameters with the same name

2002-08-30 Thread Nicholas Clark
Exegesis 4 says When the subroutine dispatch mechanism detects one or more pairs as arguments to a subroutine with named parameters, it examines the keys of the pairs and binds their values to the correspondingly named parameters -- no matter what order the paired arguments originally

@array = %hash

2002-08-30 Thread Nicholas Clark
In Damian's excellent perl6 talk, I think he said that by default a hash in list context will return a list of pairs. Hence this array = %hash for %hash with n keys would give an array of n elements, all pairs. If you want the perl5 tradition of a list alternating key,value,key,value...

Re: @array = %hash

2002-08-30 Thread Steffen Mueller
Nicholas Clark wrote: [...] And what happens if I write %hash4 = (Something, mixing, pairs = and, scalars); 1 23 4 5 Perl5 says Odd number of elements in hash assignment at -e line 1. And Perl6 should, too. IMHO, your example isn't too good

Re: @array = %hash

2002-08-30 Thread Simon Cozens
[EMAIL PROTECTED] (Steffen Mueller) writes: %hash4 = (Something, mixing, pairs = and, scalars); 1 23 4 5 Perl5 says Odd number of elements in hash assignment at -e line 1. And Perl6 should, too. Except that a pair is a single thing. %hash4

RE: @array = %hash

2002-08-30 Thread David Whipp
Steffen Mueller %hash4 = (Something, mixing, pairs = and, scalars); 1 23 4 5 Perl5 says Odd number of elements in hash assignment at -e line 1. And Perl6 should, too. Hmm, I rather like the idea of thinking of a %foo variable as a set, not a

RE: @array = %hash

2002-08-30 Thread David Whipp
Piers Cawley wrote: Maybe we should just say 'sod it' and implement the entire Smalltalk Collection hierarchy and have done with it? Sets, bags, hashes (dictionaries for the Smalltalker), whatever, all have their uses... I'm not sure if you were being facetious, but I do think all the

atomicness and \n

2002-08-30 Thread Aaron Sherman
Is C\n going to be a rule (e.g. C eol ) or is it implicitly translated to: [\x0a\x0d...]+ If it's the latter, then what does this do? \n? Do I get [[\x0a\x0d...]+]? Or do I get [\x0a\x0d...]+? If the former (which I assume is the case), how do I get the