* Dave Mitchell <davem@iabyn.com> [2016-11-08 11:36]: > If we did this this, we would have to either: > > * update $# on each loop iteration, which would slow down all loop > iterations, or > * give $# get magic that searches the context stack for a loop context, > then retrieves the current loop index stored in there. That wouldn't > slow down normal loops, but accessing $# itself might be quite slow. The latter would be fine, just as a new builtin `loopindex` instead of get magic on yet another new superglobal. How much overhead (size, speed) on scopes would we incur if each frame had a pointer to the innermost containing loop context? (On each scope check what type the immediate containing scope is, then either set the new scope’s containing loop pointer to the containing scope or copy the containing scope’s loop context pointer.) Could `next`/`last` benefit from that too? Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>Thread Previous | Thread Next