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


in reply to Re^2: C-style for loop
in thread C-style for loop

I would go as far as claiming that what's in the parens itself in that case is yet another minilanguage (very closely related to Perl itself: it consists of exactly three Perl statements!) that does not fit in other parts of Perl's syntax, and thus a very special case: of course Perl 6 knows better and gives it an entirely different name which IIRC is C<loop> and not by chance takes one letter more wrt "for" since that's for huffmanization and in fact it is thought to be on a much sparser basis to begin with.
A couple of points.

Replies are listed 'Best First'.
Re^4: C-style for loop
by blazar (Canon) on Nov 18, 2008 at 13:59 UTC
    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.

    --
    If you can't understand the incipit, then please check the IPB Campaign.