Jonadab The Unsightly One wrote:
> 
> John Siracusa <[EMAIL PROTECTED]> writes:
> 
> > Did this ever get resolved to anyone's satisfaction?  While reading
> > EX6, I found myself wonder exactly what for() would look like in
> > Perl 6 code...
> 
> A for loop[1] is basically syntax sugar for a while loop.  In general,
> where foo, bar, baz, and quux are expressions, the following are equivalent:
> 
> for (foo; bar; baz) { quux }
> foo; while (bar) { quux; baz }

Well, except that in the second, any variables declared in foo will leak
into the scope after the end of the for loop.  Also, in the second,
"baz" is inside the same scope as quux, whereas in the normal C-style
for loop, it's not.

Thus, "for (foo; bar; baz) { quux }" is really more like:

   {
      foo;
      start_for_loop:
      if( !bar ) { goto end_for_loop }
      { quux }
      baz;
      goto start_for_loop;
      end_for_loop:
   };

> If Perl6 has enough syntax-sugar ability to let you turn the former
> into the latter, then you don't need to worry about for's signature.

Well, yes.  But the point of this discussion is, precisely what *kind*
of syntactic sugar will be used.

> [1]  Of course I mean a C-style for loop.

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "[EMAIL PROTECTED]
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}

Reply via email to