develooper Front page | perl.perl5.porters | Postings from December 2019

Re: @_ Suppression

Dan Book
December 2, 2019 20:46
Re: @_ Suppression
Message ID:
On Mon, Dec 2, 2019 at 8:57 AM Zefram via perl5-porters <> wrote:

> Dave Mitchell wrote:
> >    @_ will not be set, unset or localised on entry to or exit from
> >    a signatured sub;
> Bad idea.  Having a warning for recognisable use of @_ is better than
> nothing, but according to decisions we already made it's not enough.
> Way back, we determined that detection of the use of @_ wouldn't
> be sufficiently complete to serve as the trigger for @_ suppression.
> The reasons for that decision haven't changed.  It is right that we paid
> attention to that issue in repeated decisions that we would not tie @_
> suppression to signatures.  Nothing in the rationale for those decisions
> has changed either.

This is not conditional on detection, but on enabling of the signatures
feature, a deterministic and obvious mechanism.

> @_ suppression should be controlled by means orthogonal to signatures,
> probably a per-sub attribute (which can turn suppression either on or off)
> with a lexical feature flag setting a default.  Default suppression can
> become part of a feature bundle.

While I'm not disagreeing with your argument, I also feel that practically
they are linked as far as the user is concerned, and so separating them for
the user will only lead to extra boilerplate for everyone. Suppressing @_
without enabling signatures would make subroutines virtually impossible to
use, and @_ is useless once signatures are enabled (provided the proposed
aliasing and predicate functionality is implemented).

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