in reply to Re^3: C-style for loop
in thread C-style for loop
I won't deny Perl 6 gives it a different name, but the Perl 5 parser already knows the 'loop' construct. perly.y has a token 'loop' under which all loop, including the bare block and 4 (!) 'for' constructs.
I personally believe I lost you: do you mean that C<loop> is a Perl 5 reserved keyword with some semantics associated to it? It may well be, but I've never seen it in use. Can you give an actual example of usage shedding some light on the issue?
I (also) personally believe that somehow your phrase is unfinished: "all loop" seems the subject of something... but there's a verb missing.
Each of the expressions is a different kind of expression (first introduces a scope, second is a boolean expression, third may introduce a scope), but they do fit in other parts of Perls syntax. Of course, you are right in the sense that 'for (;;)' is the only place that requires exactly three expressions.
Fair enough... both on the fact that they are expressions and that they do fit in other parts of Perl's syntax. Just as a minor point: is it true that the third may introduce a scope too? I knew that only variables declared with my in the initialization section were lexically scoped to the block following the parens...
I don't understand the huffmanization remark. [ ...]
I probably used the term improperly, then, based on what I heard: basically it all boils down to having a bare C<for> consisting of three characters for the supposedly more often used Perl-style (and only!) "for" loop and a C<loop> consisting of four characters for the supposedly less often used kind of loop that we now</c> call C-style "for" loop. Two beasts different enough from each other to warrant a totally different name altoghether in Perl 6.