Mailing List Archive

Protocol/convention for optional lint-type warnings
A few times in either perl core, or some modules like syntax modules,
I've found places where I've wanted to add very-optional warnings that
aren't enabled by default, but suggest to the author that "you're doing
something a bit weird here", or maybe "eh; this feature might be
removed in a later version so you want to swap to something else", but
it isn't yet a problem that should warn for end-users.

I'm thinking there ought to be some standard way to enable these
non-default warnings that both perl core and whatever modules can all
follow, to enable these things. I'd then want to enable that when
doing my author testing so I can see these extra things.

It shouldn't require any source changes (so any lexical pragmas etc..
are no good) because I'd want to optionally enable it during auther
testing alone, but I wonder about using an environment variable.

For example, I could

$ PERL_WARN_ME_HARDER=1 ./Build test
t/00use.t ..... Hey you probably shouldn't be doing this weird thing
at Foo.pm line 123.
t/00use.t ..... ok


Before I try to create something new (or just propose the-above), I
wonder: Are there any existing precedents for this kind of thing
already?

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Re: Protocol/convention for optional lint-type warnings [ In reply to ]
On Fri, Nov 19, 2021 at 11:55 AM Paul "LeoNerd" Evans <
leonerd@leonerd.org.uk> wrote:

> A few times in either perl core, or some modules like syntax modules,
> I've found places where I've wanted to add very-optional warnings that
> aren't enabled by default, but suggest to the author that "you're doing
> something a bit weird here", or maybe "eh; this feature might be
> removed in a later version so you want to swap to something else", but
> it isn't yet a problem that should warn for end-users.
>
> I'm thinking there ought to be some standard way to enable these
> non-default warnings that both perl core and whatever modules can all
> follow, to enable these things. I'd then want to enable that when
> doing my author testing so I can see these extra things.
>
> It shouldn't require any source changes (so any lexical pragmas etc..
> are no good) because I'd want to optionally enable it during auther
> testing alone, but I wonder about using an environment variable.
>
> For example, I could
>
> $ PERL_WARN_ME_HARDER=1 ./Build test
> t/00use.t ..... Hey you probably shouldn't be doing this weird thing
> at Foo.pm line 123.
> t/00use.t ..... ok
>
>
> Before I try to create something new (or just propose the-above), I
> wonder: Are there any existing precedents for this kind of thing
> already?
>

This is similar to my impetus for suggesting optional warnings here:
https://github.com/Perl/perl5/issues/18543

I think the first step is defining a category for such warnings, and a way
to implement them without including them in "use warnings;".

An environment variable to request them all together as you suggest, or
some subset, sounds more reasonable than an import argument that subjects
the code to all manner of future optional warnings.

-Dan