develooper Front page | perl.perl5.porters | Postings from March 2013

Re: Infinite loop in for (@a) { push @a, $_ }

Thread Previous | Thread Next
March 19, 2013 17:04
Re: Infinite loop in for (@a) { push @a, $_ }
Message ID:
Brad Gilbert wrote:
>I think I would be fine with that, as long as it's optional.

Being optional would miss the point.

>I assume it would only warn/die if the length of the array can

It would die if the sequence of element identities changes.  Changing the
*values* of elements is permitted, whether through the loop's element
alias or otherwise.

>Though this is really only a problem when the length of the
>array can get bigger.

Getting shorter could be quite a problem if it means you're now on
the seventh element of three.  Any change to the array's value (the
sequence of element identities) is a problem if the iterator made the
mostly-reasonable assumption that there would be no such change.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About