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

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

Thread Previous | Thread Next
From:
Mark Overmeer
Date:
September 29, 2011 08:26
Subject:
Re: [perl #100364] exit doesn't match its documentation
Message ID:
20110929152617.GJ9884@moon.overmeer.net

Deja vu.
Remember the discussion about the prototypes in POSIX.pm?
To add a few:

* Nicholas Clark (perlbug-followup@perl.org) [110929 13:38]:
> # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=100364 >
> 
> $ ~/Sandpit/5000/bin/perl -lwe 'exit 1 == 1'; echo $?
> Useless use of numeric eq in void context at -e line 1.
> 1
> $ ~/Sandpit/5000/bin/perl -lwe 'exit 1 == 0'; echo $?
> Useless use of numeric eq in void context at -e line 1.
> 1

 perl -MPOSIX=exit -wle 'exit 1 == 1'; echo $?
 1

 perl -MPOSIX=exit -wle 'exit 1 == 0'; echo $?
 0

My suggestion was to add a prototype to POSIX::exit because CORE::exit($)
has prefix-operator priority caused by its ($) prototype and POSIX::exit
is simply a list operator.  Adding a simple name to the include list
of POSIX changes the syntax of the whole file!  Not only for exit.

But most people voted for the backward compatibility of POSIX::exit(@x)
to return $x[0], over consequent behavior.
-- 
Regards,

               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark@Overmeer.net                          solutions@overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net


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