Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing the warning for smartmatch

111 views
Skip to first unread message

Philippe Bruhat (BooK)

unread,
Aug 26, 2022, 9:30:05 AM8/26/22
to Perl 5 Porters
Back in June, Dave Mitchell started a thread titled "disabling
smartmatch and when()?"
http://nntp.perl.org/group/perl.perl5.porters/264087

During the discussion, it was noted that using smartmatch throws the
warning "Smartmatch is experimental", and that even though
"experimental" is documented to also mean "can be removed at any time",
we want to make it clear using smartmatch is officially *discouraged*.

The PSC believes we should make it explicit in this warning that
smartmatch is deprecated / discouraged.

During one of our PSC meetings Paul noted that, contrary to
"experimental", the "deprecated" warning does not group more specific
warnings, and that he sometimes found it would be useful to be able pick
which deprecation warnings to silence.

My goal starting this thread is to discuss:
- the wording of a better warning message for experimental::smartmatch
- the creation of a new group of warnings ("deprecated" already exists,
we might not need to find a new word), of which the ::smartmatch
warning would be part

--
Philippe Bruhat (BooK)

When you deal in weapons, there are no winners... only losers.
(Moral from Groo The Wanderer #31 (Epic))

Philippe Bruhat (BooK)

unread,
Sep 24, 2022, 2:30:05 PM9/24/22
to Perl 5 Porters
On Fri, Aug 26, 2022 at 03:11:23PM +0200, Philippe Bruhat (BooK) wrote:
> Back in June, Dave Mitchell started a thread titled "disabling
> smartmatch and when()?"
> http://nntp.perl.org/group/perl.perl5.porters/264087
>
> During the discussion, it was noted that using smartmatch throws the
> warning "Smartmatch is experimental", and that even though
> "experimental" is documented to also mean "can be removed at any time",
> we want to make it clear using smartmatch is officially *discouraged*.
>
> The PSC believes we should make it explicit in this warning that
> smartmatch is deprecated / discouraged.

This is happening in https://github.com/Perl/perl5/pull/20337.

Summary:
* using smartmatch, `given` or `when` will print the warning "Smartmatch
is deprecated"
* `no warnings 'experimental::smartmatch';` becomnes a no-op
* `no warnings 'deprecated::smartmatch';` will silence the warning
* 'deprecated' becomes a warning category, and `no warnings 'deprecated';`
will also silence the warning, along with all the other deprecation
warnings
* 'deprecated::smartmatch' is separate from the other deprecation
warnings, to give those who still use it the ability to do so with
having to silence all other deprecation warnings

--
Philippe Bruhat (BooK)

Only a fool follows orders without knowing why.
(Moral from Groo The Wanderer #86 (Epic))
0 new messages