develooper Front page | perl.perl5.porters | Postings from October 2014

[perl #123062] & prototype is too permissive

Thread Next
Father Chrysostomos
October 26, 2014 19:41
[perl #123062] & prototype is too permissive
Message ID:
# New Ticket Created by  Father Chrysostomos 
# Please include the string:  [perl #123062]
# in the subject line of all future correspondence about this issue. 
# <URL: >

According to perlsub, ‘An "&" requires an anonymous subroutine, which, if passed as the first argument, does not require the "sub" keyword or a subsequent comma.’

In actuality, it also allows ‘undef’, \@array, \%hash, \&sub, and \($list, @of, %refs) in addition to sub{...}.

Recently I accidentally extended it to \$scalar as well, so I want to undo that accidental change and make it more restrictive.

The way the code is written suggests to me that undef was intentional but \@array and \%hash (and maybe even \&sub) were accidentaly.  But \&sub seems useful, and that may be in use already on CPAN.  \@array and \%hash were clearly accidental, and lists of refs screw up the number of arguments that the sub thinks its getting.

So should I allow sub{}, undef, and \&sub?


Father Chrysostomos

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