http://www.perlmonks.org?node_id=743913


in reply to Re^6: For vs. Foreach
in thread For vs. Foreach

Of course the C-style and csh-style forms are fundamentally different. No one was arguing against that.

The "obscure implementation distinction" to which I referred is one that javafan pointed out in Re^2: For vs. Foreach. Beyond that obscure, and as far as I can tell useless, implementation distinction, the keywords for & foreach are interchangeable, and can both be used to construct either form--C-style or csh-style--of loop.

Your unilateral decision to use the keyword for to refer exclusively to the C-style form, and foreach to refer to the csh-style form, (and to consider the alternate uses as "misspellings"), is arbitrary and capricious, and does not succeed in "keep[ing] it simple for people using the shorthand "for" vs "foreach".".

Given the prevalence of available code that uses either keyword for either form of loop, it will just further confuse things. Far better to just say it like it is, for & foreach are synonyms and either can be used to construct either of two forms of loop.

There is a good argument that the keywords should have been dedicated one to each of the two forms, along the lines which you favour, and were we at the point where that decision was being made, I would have backed you in that argument. But that time has long gone.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.