On Mon, Aug 28, 2000 at 04:10:01PM -0400, Eric Roode wrote:
> Peter Scott wrote:
> >Graham Barr once allowed as how he thought it would be neat if you could say
> >
> > for my($x, $y, $z) (@list) { ... }
>
> ObLanguageMinimalist:
>
> Um. Is this so frequently-used that the above syntax is preferable to:
>
> while ( ($x, $y, $z) = splice (@list, 0, 3) ) {...}
>
> ? (notwithstanding the destructive nature of splice)
Maybe not with 3 variables, but how many people do
my %hash = @_;
while(my($k,$v) = each %hash) { ... }
so that they can process named arguments ?
Having this would remove the need for the hash assignment. Also it hash been
suggested that it could potentially replace each
for my($k,$v) (%hash) { ... }
Also the ability to traverse multiple lists at once
for ($a,$b,$c) (zip(@a,@b,@c)) { ... }
And I should think many more uses I cannot think of.
Graham.
- Re: Beefier prototypes (was ... Chaim Frenkel
- Re: Beefier prototypes (was ... Bart Lateur
- Re: Beefier prototypes (was ... Tom Christiansen
- Re: Beefier prototypes (was Re: Multiple for loop... John Porter
- Re: Beefier prototypes (was Re: Multiple for loop... Damian Conway
- Re: Beefier prototypes (was Re: Multiple for ... Chaim Frenkel
- Re: Beefier prototypes (was Re: Multiple for ... Damian Conway
- Re: Beefier prototypes (was Re: Multiple ... Chaim Frenkel
- Re: Beefier prototypes (was Re: Multiple ... Damian Conway
- Re: Multiple for loop variables Eric Roode
- Re: Multiple for loop variables Graham Barr
- Re: Multiple for loop variables John Porter
- Re: Multiple for loop variables Steve Simmons
- Re: Multiple for loop variables Peter Scott
- Re: Multiple for loop variables David L. Nicol
- Re: Multiple for loop variables Eric Roode
- Re: Multiple for loop variables Jonathan Scott Duff
- Re: Multiple for loop variables Jeremy Howard
