develooper Front page | perl.perl5.porters | Postings from November 2016

Re: [perl #130038] Builtin variable for loop index in foreach

Thread Previous | Thread Next
From:
Zefram
Date:
November 28, 2016 12:34
Subject:
Re: [perl #130038] Builtin variable for loop index in foreach
Message ID:
20161128123408.GC12355@fysh.org
Hugo van der Sanden via RT wrote:
>You also get the benefit that *you already have this*:

Except that foreach and while/each have completely different behaviour
with respect to iterators and modification during iteration.  There's
value in adding the indexed form of foreach, even with the language
already having array each.

>I'm guessing (wildly) that when the "experimental each on scalar"
>deprecation advances to removal, we could consider extending each()
>to lists to support:

Wouldn't be possible.  There's nowhere for the iterator to live.

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About