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

Amending the perlsub documentation about empty returns

Thread Next
From:
Robert Rothenberg
Date:
March 6, 2023 16:52
Subject:
Amending the perlsub documentation about empty returns
Message ID:
87df4d5e-28ed-a4a7-4648-447b49d59e76@cpan.org
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.

Note that there is some discussion advocating empty returns in the 
Perl::Critic policy, but I've created an issue suggesting that the 
documentation be amended to indicate where it's a bad idea 
https://github.com/Perl-Critic/Perl-Critic/issues/942




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