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 07:08
Subject:
Re: use warnings ':most'
Message ID:
CABMkAVUCCXWSLixjOgHEGKaDyMqvQZk3c2=uKjk_7gD2OwpFjg@mail.gmail.com
On Sun, Jun 6, 2021 at 3:05 AM Dan Book <grinnz@gmail.com> wrote:

> On Sun, Jun 6, 2021 at 2:38 AM Eric Brine <ikegami@adaelis.com> wrote:
>
>> On Wed, Jun 2, 2021 at 7:02 PM Leon Timmermans <fawaka@gmail.com> wrote:
>>
>>> 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'
>>>
>>
>> "once" is exactly the kind of warning a newcomer should have enabled.
>>
>> A user performing advanced symbol table manipulation has no problems
>> turning off "once" when needed.
>>
>> Secondly, I want «use warnings» without a tag to do :most instead of :all
>>>
>>
>> This is backwards incompatible, and it hurts newcomers.
>>
>> The advanced user will know to use :most if that's what they want. The
>> newcomer is suddenly told about fewer likely problems.
>>
>
> If not enabled by default, ':most' is entirely pointless. The purpose is
> to improve the default when applied via bare 'use warnings' or 'use
> VERSION', since that is what almost all code uses.
>
> Changes to warnings do not break compatibility by policy. This doesn't
> mean we should change them willy nilly, and changes to the interface can
> still break compatibility, but warnings themselves are added and adjusted
> in every release, removing them from the default is the same.
>
> 'once' warnings are not useful to newcomers, as they only (unreliably)
> occur when writing code that uses package variables.
>

To add, my view is that "optional warnings", however they may be
implemented, would be those warnings which are useful for someone, but
annoying for most (and thus commonly result in warnings being disabled
entirely due to pointless noise). We don't have a lot of these currently
because, since all warnings are enabled by 'use warnings', developers have
been careful not to introduce unnecessarily noisy warnings. But with a
mechanism where they aren't enabled unless requested, it is then reasonable
to add such.

-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