Skip to content

Rename features all and any with a keyword_ prefix #23105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 58 additions & 55 deletions feature.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions keywords.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion keywords.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/B/Deparse-core.t
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ sub testit {
else {
package test;
use subs ();
no warnings qw( experimental::any experimental::all );
no warnings qw( experimental::keyword_any experimental::keyword_all );
import subs $keyword;
$code = "no warnings 'syntax'; no strict 'vars'; sub { ${vars}() = $expr }";
$code = "use feature 'isa';\n$code" if $keyword eq "isa";
Expand Down
20 changes: 8 additions & 12 deletions lib/feature.pm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions lib/warnings.pm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions pod/perldelta.pod
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,33 @@ here, but most should go in the L</Performance Enhancements> section.

[ List each enhancement as a =head2 entry ]

=head2 Renamed C<any> and C<all> features to C<keyword_any> and C<keyword_all>

Perl release 5.41.7 introduced two new experimental features, called C<any>
and C<all>, which enable keywords of the same names. Those keywords provide
list-processing operators inspired by the ones from L<List::Util> of the same
name. It was subsequently considered that the names of these two features
are confusingly close to the ability of the C<feature> module to refer to all
of its features by using the C<:all> export tag.
(L<GH #23104|https://github.com/Perl/perl5/issues/23104>).

As a consequence, these feature flags have now been renamed to C<keyword_any>
and C<keyword_all> to avoid this confusion. Likewise, the related
experimental warning flags are also renamed to C<experimental::keyword_any>
and C<experimental::keyword_all>. Apart from these new flag names, the
actual syntax and semantics of these two operators remains unchanged since
their appearance in Perl release 5.41.7.

use v5.40;
use feature 'keyword_all';
no warnings 'experimental::keyword_all';

my @numbers = ...

if(all { $_ % 2 == 0 } @numbers) {
say "All the numbers are even";
}

=head1 Security

XXX Any security-related notices go here. In particular, any security
Expand Down
Loading
Loading