On Fri, Aug 18, 2000 at 09:07:31AM -0500, Christopher J. Madsen wrote: [ Very Good examples elided ] > With the explicit counter, > > foreach $item $index (@array) { ... } > > $index could (and should) be a read-only variable (like $i is in > "foreach $i (1,2,3,4)"). This would make sure that it really was the > index it claimed to be. Excellent summary of why an explicit index is a Good Thing as compared to the programmer doing it himself. I think the syntax would need to be different though, how do you use implicit $_ and an index? (Don't Do That is not an answer because people will want it) Here are some ideas: # Gosh, let's overuse : like python! ;-) for $item:$index (@array) { ... } for :$index (@array) { ... } # $_ and counter for (@array : index($index)) { ... } for (@array) $index { ... } -Scott -- Jonathan Scott Duff [EMAIL PROTECTED]
- RFC 120 (v2) Implicit counter in for statements, pos... Perl6 RFC Librarian
- Re: RFC 120 (v2) Implicit counter in for statem... Christopher J. Madsen
- Re: RFC 120 (v2) Implicit counter in for st... Glenn Linderman
- Re: RFC 120 (v2) Implicit counter in for st... David L. Nicol
- Re: RFC 120 (v2) Implicit counter in fo... Christopher J. Madsen
- Re: RFC 120 (v2) Implicit counter i... Jonathan Scott Duff
- Re: RFC 120 (v2) Implicit coun... Christopher J. Madsen
- Re: RFC 120 (v2) Implicit ... Jonathan Scott Duff
- Re: RFC 120 (v2) Impli... Christopher J. Madsen
- Re: RFC 120 (v2) Implicit ... Ariel Scolnicov
- Re: RFC 120 (v2) Impli... Mike Pastore
- Re: RFC 120 (v2) Impli... David L. Nicol
- Re: RFC 120 (v2) Impli... Johan Vromans
- Re: RFC 120 (v2) Impli... Buddha Buck
- Re: RFC 120 (v2) Implicit counter in for st... Ken Fox
- Re: RFC 120 (v2) Implicit counter in fo... Graham Barr