From 213530800d715965e2230f80413ab06a27458379 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Thu, 15 May 2025 10:01:52 +1000 Subject: [PATCH 1/3] feature: switch no longer being removed It no longer produces experimental warnings. Fixes #23282 --- lib/feature.pm | 14 +++----------- regen/feature.pl | 14 +++----------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/lib/feature.pm b/lib/feature.pm index 9b0b8d5e6af7..defae2639784 100644 --- a/lib/feature.pm +++ b/lib/feature.pm @@ -4,7 +4,7 @@ # Any changes made here will be lost! package feature; -our $VERSION = '1.95'; +our $VERSION = '1.96'; our %feature = ( fc => 'feature_fc', @@ -196,21 +196,13 @@ See L for details. =head2 The 'switch' feature -B: This feature is still experimental and the implementation may -change or be removed in future versions of Perl. For this reason, Perl will -warn when you use the feature, unless you have explicitly disabled the warning: - - no warnings "experimental::smartmatch"; - C tells the compiler to enable the Raku given/when construct. See L for details. -This feature is available starting with Perl 5.10. -It is deprecated starting with Perl 5.38, and using -C, C or smartmatch will throw a warning. -It will be removed in Perl 5.42. +This feature is available starting with Perl 5.10. It is enabled by +feature bundles 5.10 through 5.34. =head2 The 'unicode_strings' feature diff --git a/regen/feature.pl b/regen/feature.pl index 94b598a0c139..4ec02db6d85a 100755 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -618,7 +618,7 @@ sub longest { __END__ package feature; -our $VERSION = '1.95'; +our $VERSION = '1.96'; FEATURES @@ -727,21 +727,13 @@ =head2 The 'smartmatch' feature =head2 The 'switch' feature -B: This feature is still experimental and the implementation may -change or be removed in future versions of Perl. For this reason, Perl will -warn when you use the feature, unless you have explicitly disabled the warning: - - no warnings "experimental::smartmatch"; - C tells the compiler to enable the Raku given/when construct. See L for details. -This feature is available starting with Perl 5.10. -It is deprecated starting with Perl 5.38, and using -C, C or smartmatch will throw a warning. -It will be removed in Perl 5.42. +This feature is available starting with Perl 5.10. It is enabled by +feature bundles 5.10 through 5.34. =head2 The 'unicode_strings' feature From a61c9d8e114125ab79d1e8fab062ed2ff3743968 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Mon, 19 May 2025 09:52:45 +1000 Subject: [PATCH 2/3] perlsyn/switch: no longer experimental but discouraged --- pod/perlsyn.pod | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod index 2de8e8370fde..4e03eabc3617 100644 --- a/pod/perlsyn.pod +++ b/pod/perlsyn.pod @@ -863,12 +863,15 @@ C. X X X X X +The C feature is discouraged for new code and is retained for +backward compatibility. + Starting from Perl 5.10.1 (well, 5.10.0, but it didn't work right), you can say use feature "switch"; -to enable an experimental switch feature. This is loosely based on an +to enable the switch feature. This is loosely based on an old version of a Raku proposal, but it no longer resembles the Raku construct. You also get the switch feature whenever you declare that your code prefers to run under a version of Perl between 5.10 and 5.34. For @@ -876,7 +879,7 @@ example: use v5.14; -Under the "switch" feature, Perl gains the experimental keywords +Under the "switch" feature, Perl gains the keywords C, C, C, C, and C. Starting from Perl 5.16, one can prefix the switch keywords with C to access the feature without a C @@ -893,8 +896,8 @@ in the previous section could be rewritten as default { $nothing = 1 } } -The C is the non-experimental way to set a topicalizer. -If you wish to use the highly experimental C, that could be +The C is another way to set a topicalizer. +If you wish to use C, that could be written like this: use v5.10.1; From 63db6c78f820d1599955d90dc7a883ba6ce55975 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Mon, 19 May 2025 10:37:12 +1000 Subject: [PATCH 3/3] perlop/smartmatch: now a "feature" and discouraged, not experimental --- pod/perlop.pod | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index e31144e5361d..3a374d96bc32 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -682,13 +682,21 @@ C (or higher) declaration in the current scope. =head2 Smartmatch Operator -First available in Perl 5.10.1 (the 5.10.0 version behaved differently), -binary C<~~> does a "smartmatch" between its arguments. This is mostly +The C feature is discouraged for new code and retained for +backward compatibility. + +The smartmatch operator was introduced in 5.10.0 had significant +changes in 5.10.1. It is enabled by default and in all feature +bundles up to 5.40. To use smartmatch with a later feature bundle you +will need enable it explicitly: + + use v5.42; + use feature "smartmatch"; + +Binary C<~~> does a "smartmatch" between its arguments. This is mostly used implicitly in the C construct described in L, although not all C clauses call the smartmatch operator. Unique among all of -Perl's operators, the smartmatch operator can recurse. The smartmatch -operator is L and its behavior is -subject to change. +Perl's operators, the smartmatch operator can recurse. It is also unique in that all other Perl operators impose a context (usually string or numeric context) on their operands, autoconverting