develooper Front page | perl.perl5.porters | Postings from September 2011

Re: [perl #100364] exit doesn't match its documentation

Thread Previous | Thread Next
From:
Zefram
Date:
September 30, 2011 02:58
Subject:
Re: [perl #100364] exit doesn't match its documentation
Message ID:
20110930095839.GF12382@lake.fysh.org
David Golden wrote:
>How about this ultra redundant form:
>
>    exit EXITCODE
>    exit( EXPR )

If you're trying to be that clear, the "EXPR" is still wrong.  "1,2"
is an expression, but:

    $ perl -lwe 'exit(1,2)'
    Too many arguments for exit at -e line 1, at end of line
    Execution of -e aborted due to compilation errors.

You could accurately say:

    exit ARITHEXPR
    exit(TERMEXPR)

except with the understanding that an arithmetic expression beginning with
a paren will be treated as the latter form.  And with some exception for
expressions involving the low-precedence logic operators, but I think we
ought to be making that bit of the grammar sane rather than documenting
the insanity.  Since the grammar behaves the same way for most builtins,
I think it ought to be documented in one place, not separately for each
function, possibly not in perlfunc at all.

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About