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 16:21
Subject:
Re: patches wanted: default warnings/strict
Message ID:
CACBZZX78F5CTuSCQN5nNOCgQEM8Q-SzmGvcx0pvticzEURch+g@mail.gmail.com
On Fri, Oct 16, 2015 at 4:27 AM, Ricardo Signes
<perl.p5p@rjbs.manxome.org> wrote:
> Hey, remember the big thread about making "use warnings" mean "use warnings
> 'default'" and that?  No?  It was here:
>
>   http://nntp.perl.org/group/perl.perl5.porters/228400
>
> I'd been hoping to get to this myself, but it hasn't happened.  I'd like to get
> this ready for smoking so we can hopefully make this change for 5.24.
>
> I think it should mostly be "work" and not "deep, hard thinking."  I could be
> wrong.
>
> Who's up for it?

I can do it.

First, let me see if I understand what you'd like. Most of this
discussion has been paged out of my brain my now.

As far as I can tell this is just a matter of reverting my
v5.21.8-54-g3c3f8cd but changing "everything -> all" and "all ->
default" in the categories I used there, and accepting that:

    use warnings;

And:

    no warnings;

Will not be symmetric operations. I.e. they'll mean:

    use warnings 'default';
    no warnings 'all';

Instead of the current:

    use warnings 'all';
    no warnings 'all';

And going forward the semantics of "all" will be that we'll use it as
a bucket for absolutely all warnings, instead of the current
conservative approach.

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';

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";'

I'm fine with all of this by the way. As I've before the "everything"
v.s. "all" patch I had was a bend-over-backwards approach to not break
any existing promises at the cost of having a really confusing
interface. There'll be some slight pains in doing "all" & "default"
but I think it makes perfect sense going forward.

I just wanted to clarify that I've understood you correctly before I
start hacking on this. So please tell me whether I have or haven't :)

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