On Fri, 2002-07-12 at 13:22, Thomas A. Boyer wrote: > Aaron Sherman wrote: > > An example: > > > > $pid = fork() // -1; > > if $pid < 0 { > > # error ... > > } else unless $pid { > > # Parent > > } else if $pid > 0 { > > # Child > > } else { > > # Huh? Can't happen > > } > > Of course, your indentation implies a different syntax than the parser actually sees.
I don't think so. What do you see when you look at that? Is there more than one order? "if ... else unless ... else ..." is different from "if .... elsif (!...) ... else ..." in what way? I think you're confusing nested if statements (which is all you can do in C, you don't have any other option) with this syntax for chaining conditionals (which is more like a C switch). Granted you can do the same thing in C in terms of effect, the language just doesn't give you a handy syntax for it. This syntax is actually much less ambiguous than "1 + 2 * 3 + 4", for which you have to know precedence to resolve the ambiguity. But, realistically I'm still doing it the Perl5 way. The "else if" vs "elsif" distinction is only important to the "lexer" (not that there will be a clear distinction in Perl6). I'm still not 100% happy with dropping the ()s around the expr, but I can see why it's appealing.