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

Re: use warnings ':most'

Thread Previous | Thread Next
From:
shmem
Date:
June 6, 2021 22:33
Subject:
Re: use warnings ':most'
Message ID:
alpine.DEB.2.21.2106070011000.10116@lvps178-77-101-18.dedicated.hosteurope.de
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?

0--gg-

-- 
_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                               /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
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