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

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

Thread Previous | Thread Next
September 30, 2011 02:58
Re: [perl #100364] exit doesn't match its documentation
Message ID:
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

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.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About