develooper Front page | perl.perl5.porters | Postings from March 2023

Re: Amending the perlsub documentation about empty returns

Thread Previous | Thread Next
From:
Dan Book
Date:
March 6, 2023 17:06
Subject:
Re: Amending the perlsub documentation about empty returns
Message ID:
CABMkAVUT=ZAHdc1f_WEQczmubVwYwrmPD1_sieq7C4j+Ji7HbQ@mail.gmail.com
On Mon, Mar 6, 2023 at 11:52 AM Robert Rothenberg <rrwo@cpan.org> wrote:

> The perlsub documentation briefly discusses empty returns:
>
>  > If you specify no return value, the subroutine returns an empty list
> in list context, the undefined value in scalar context, or nothing in
> void context.
>
> This really needs some elaboration on when its good to specify no return
> value, and when it's not, such as when the return value is on the right
> side of a fat comma.
>

That assumes the return and the call are written by the same person or even
in the same project which is often not the case when such issues occur. But
a sentence or two on the danger may be warranted.

-Dan

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