On Fri, 2002-07-12 at 02:33, Sean O'Rourke wrote:

> What's currently "supported":

> - if/elsif/else (even "unless" and the feared "elsunless";)

When we talked about this last, I had been concerned about loops and
conditionals, but others had scoping concerns. Ok, perhaps there's no
way we can roll in loops (though that seems wrong to me), but please
don't do THIS.

There's really no good reason to continue treating conditionals this
way. A simple

    cond: ('if'|'unless') expr block [ 'else' (cond|block) ]
    
solves the whole thing; is easy to write and parse; and reduces the
number of keywords in Perl. Could it be a better option if you added
whipped cream and a cherry?! This never gets as ugly as C because the
only tokens that can follow 'else' are 'if' 'unless' and '{'... no
ambiguity.

Now, for those who will freak out, you could preserve "elsif" as a
deprecated form, but I'd at least say that it should generate a
compatibility warning so that it's fair game for later removal.

An example:

    $pid = fork() // -1;
    if $pid < 0 {
        # error ...
    } else unless $pid {
        # Parent
    } else if $pid > 0 {
        # Child
    } else {
        # Huh? Can't happen
    }


Reply via email to