On Tue, Aug 29, 2000 at 09:15:35AM +0100, John McNamara wrote:
> At 13:11 28/08/00 -0400, Steve Simmons wrote:
> >To tell the truth, this third item should probably should become
> >a separate RFC, and if you'd like to simply say one is forthcoming,
> >that'd be fine by me.
>
> What I really want to do is write a summary, get some consensus and redraft
> the RFC. I'll do this in the next few days.
> As far as I can see the current consensus is as follows:
> 1. Implicit variable: nice but not really worth the trouble.
> 2. Explicit variable between foreach and the array: might conflict
> with other proposals.
This doesn't conflict with the idea of assigning multiple variables
per loop execution as long as explict grouping of the vars assigned
to is required. As examples:
foreach ( $var, $var2 ) $i ( @arr ) { } # OK
foreach $var, $var2, $i ( @arr ) { } # Not OK
foreach $var, $var2 $i ( @arr ) { } # Not OK
foreach ( @list ) $i ( @arr ) { } # OK
foreach ( @list, $var ) $i ( @arr ) { } # OK
foreach @list, $var $i ( @arr ) { } # Not OK
Some underlying logic for this
o it allow one to use the original $_ in the body while still
permitting use of an index var, ie
foreach () $i { something( $_, $i ) }
o any use of the index var which is inadvertantly given to
pre-perl6 code will bomb with a syntax error
If I get up and write that RFC, that's how I'll propose it be done.