From: Nicholas Clark Date: Tue, 13 Jul 2004 21:10:21 +0000 (+0000) Subject: Some thoughts on foreach reverse X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a5c75c1d181494e06a58988f267a8b3d081df483;p=p5sagit%2Fp5-mst-13.2.git Some thoughts on foreach reverse p4raw-id: //depot/perl@23104 --- diff --git a/pod/perltodo.pod b/pod/perltodo.pod index db7274c..1560956 100644 --- a/pod/perltodo.pod +++ b/pod/perltodo.pod @@ -183,6 +183,10 @@ code review. Also fchdir is available in some platforms." The old perltodo notes that we could optimise foreach to iterate in reverse. (instead of making a reversed copy on the stack) +It seems that cx->blk_loop.itermax could be hijacked to act as a go up/go +down flag, with cx->blk_loop.iterix primed in pp_enteriter for the go down +case (ie reverse). However, it looks slightly tricky identifying the shape of +foreach reverse in the optree in Perl_peep. =head1 Tests