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

Re: patches wanted: default warnings/strict

Thread Previous | Thread Next
From:
Ævar Arnfjörð Bjarmason
Date:
October 18, 2015 17:20
Subject:
Re: patches wanted: default warnings/strict
Message ID:
CACBZZX4VFFLSXr8BssvuD0Ji+DTEdjH0ctn7aVSwCbCPCptK6g@mail.gmail.com
On Sun, Oct 18, 2015 at 7:11 PM, Paul Johnson <paul@pjcj.net> wrote:
> On Sun, Oct 18, 2015 at 06:20:33PM +0200, Ęvar Arnfjörš Bjarmason wrote:
>
>> First, let me see if I understand what you'd like. Most of this
>> discussion has been paged out of my brain my now.
>
> I think you are correct with what needs to be done, but rjbs can
> confirm.

Thanks.

>> We'd also say that if you in the past wrote:
>>
>>     use warnings FATAL => "all";
>>
>> You'd just need to change that to:
>>
>>    use warnings FATAL => "default";
>>
>> Or better yet:
>>
>>     use warnings 'FATAL';
>
> If that's what the author wants.  I suspect many who write
>
>   use warnings FATAL => "all";
>
> will want to leave it just like that.

They probably won't once we start adding pedantic warnings.

>> And finally, we'd change all the warnings.pm documentation to
>> recommend "default" instead of "all", and note how if you want to
>> write programs that function as intended for post-v5.24 and pre-v5.24
>> you need to conditionally enable either "default" or "all".
>>
>> E.g. if you need the recommended set of fatal warnings you should do:
>>
>>     use warnings FATAL => $] >= 5.024000 ? "default" : "all";'
>
> If you are targeting 5.18 and earlier, yes, otherwise you can get away
> with the plain
>
>   use warnings "FATAL";
>
> It's a shame that that is rather messy, but I suppose you can make a
> good case that users of "FATAL all" have made their bed.

It's not just FATAL warnings, although those are a particular sticking
point since before 5.18 that was the recommended and *only* way to
turn them on.

As we start adding pedantic warnings we wouldn't have put into "use
warnings" before for fear of them being too disruptive to existing
code (which is the whole point of this exercise) we're also going to
have some confused users of code that does "use warnings qw(all)" with
the intent of getting the "sane default":

    http://grep.cpan.me/?q=use%5Cs%2Bwarnings%5B%27%22%28%5Cw%5Cs%5D%2Ball

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