Mailing List Archive

Pre elevator pitch: Loop Info
Hello All,

I would like to get opinions from the community on a change I would like to see, so I thought I write my PrePPC in the style as defined on https://github.com/Perl/PPCs

So keeping it short and sweet, here is my thinking:

Here is a problem.
I cannot without adding additional code find out what positing in an index I am presently processing, nor can I tell if I am on the final iteration.

Here is the syntax that I’m proposing.
${^LOOPCOUNT} and ${^LOOPINDEX} (Naming is not final, willing to change if people would prefer something else}, available in every FOR & FOREACH.

Here are the benefits of this.
No more $i’s everywhere being untidy.
Removing the constant questions regarding this very functionality that seem to have happened frequently since the birth of Perl.

Here are the potential problems.
Minor overhead added to all loops, though perhaps this could be a triggerable feature requiring a “use feature ‘infoloop’” or such.

Thank you for reading ????