On Sat, 18 Jan 2003, Michael Lazzaro wrote:
> So 'if' and friends are just (native) subroutines with prototypes like:
>
>    sub if (bool $c, Code $if_block) {...};

IIRC it's not that pretty, unfortunately, if you want to support this:

    if $test1 {
        # blah
    } elsunless $test2 {
        # ...
    }

since that gets parsed as

    if($test1, { ... }) # aiee: too many arguments to "if"

One possible solution would be to say that there's an implicit "whatever
we need" after a closed curly.  In that case there are two ways to go:
(1) we can define things like "if" to be statements rather than
expressions (a la C), and closed-curlies as the last arguments of
"statement-like" functions can always have an implicit ";"; or (2) we can
say that "}" results in an implicit ";" whenever we're at the end of an
argument list and see a term rather than an operator.  I think we turned
up some nasty ambiguities with (2) last time we discussed this.  It would
certainly wreak havoc with unary minus.

The other way is the "newline after curly" rule, which has a foul taste
for those of us who cuddle our ifs.

/s

Reply via email to