On Mon, Apr 29, 2002 at 10:26:26AM -0400, Aaron Sherman wrote:
> On Fri, 2002-04-26 at 19:30, Miko O'Sullivan wrote:
>
> > 1) Do we have a reality check on why this syntax is needed?
>
> It's because the alternative is:
>
> Perl5:
> $did = 0;
> for($i=0;$i<$max;$i++) {
> ...
> }
> unless ($did) {
> foreach (@x) {
> ...
> }
> }
>
> Perl6:
>
> loop $i=0;$i<$max;$i++ {
> ...
> ELSE {
> for @x -> $_ {
> ...
> }
> }
> }
>
> Proposed Perl6:
>
> loop $i=0;$i<$max;$i++ {
> ...
> } elsfor @x -> $_ {
> ...
> }
You left off possibility #4:
loop $i=0;$i<$max;$i++ {
...
} else {
for @x -> $_ {
...
}
}
At first glance I kind of like possibility #5:
> loop $i=0;$i<$max;$i++ {
> ...
> } else for @x -> $_ {
> ...
> }
But you still have the added complexity of which keywords can be used
that way. And you've only saved two curly braces.
Allison