develooper Front page | perl.perl5.porters | Postings from June 2021

Re: use warnings ':most'

Thread Previous | Thread Next
From:
Dan Book
Date:
June 6, 2021 22:40
Subject:
Re: use warnings ':most'
Message ID:
CABMkAVXRLnTOhgAtm2_x3yrE=dQqGibUOqpVPYya0SeE73eCSg@mail.gmail.com
On Sun, Jun 6, 2021 at 6:34 PM shmem <gm@qwurx.de> wrote:

> From the keyboard of Leon Timmermans [03.06.21,01:02]:
>
> > I would like to propose to add a new warning category, tentatively named
> "most". This would
> > include everything in :all except warnings that are likely to give false
> positives. In 5.36
> > that would be :all minus 'once', but I can imagine more warnings being
> added to :all in the
> > future that wouldn't be appropriate for :most.
> >
> > Secondly, I want «use warnings» without a tag to do :most instead of
> :all, and likewise
> > «use 5.36;».
> >
> > Leon
>
> I proppose another approach, since most people will have different ideas
> about what ":most" should mean. I'd introduce negating warnings at 'use'
> by prefixing the category or warning with a dash
>
> use warnings qw(-once); # enables all warnings except 'once'
>
> which is just a lazy way to say
>
> use warnings;
> no warnings 'once';
>
> That way everbody can roll his own warning exceptions in an easy way.
> I'd boilerplate my stuff with
>
> use warnings (
>      'all',
>      '-once',
>      '-redefine',
>      '-uninitialized',
> );
>
> which gives a clear message of the evil things I'm doing, and I can
> turn on warnings by just switching the first blank to a '#' in devel
> mode. Does this sound reasonable?


This is already a feature (recently added) except that it won't enable
warnings you didn't specify explicitly:
https://perldoc.perl.org/warnings#%22Negative-warnings%22

But this doesn't address the issue at hand, which is adjusting what is
enabled by default by "use warnings;" or "use VERSION;".

-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