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

[perl #123062] & prototype is too permissive

Thread Next
From:
Father Chrysostomos
Date:
October 26, 2014 19:41
Subject:
[perl #123062] & prototype is too permissive
Message ID:
rt-4.0.18-18379-1414352450-1544.123062-75-0@perl.org
# New Ticket Created by  Father Chrysostomos 
# Please include the string:  [perl #123062]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=123062 >


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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About