Skip to content

Commit 8a02180

Browse files
committed
Suggest that the feature flags should be called 'any' and 'all' to match the operators
1 parent 8ff6f03 commit 8a02180

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

ppcs/ppc0027-any-and-all.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ Most code of any appreciable size tends to make use of at least the `any` or `al
1919

2020
## Specification
2121

22-
New named features that, when enabled, activate syntax analogous to the existing `grep` operator, named `any` and `all`:
22+
New named features that, when enabled, activate new operators analogous to the existing `grep` operator. The features, and the operators, are named `any` and `all`:
2323

2424
```perl
25+
use feature qw( any all );
26+
2527
any { BLOCK } LIST
2628

2729
all { BLOCK } LIST
@@ -50,7 +52,7 @@ Some::Class->new(
5052

5153
## Backwards Compatibility
5254

53-
As these new operators are guarded by named features, there are no immediate concerns with backward compatiblity in the short-term.
55+
As each new operator is guarded by a named feature, there are no immediate concerns with backward compatiblity in the short-term.
5456

5557
In the longer term, if these named features become part of a versioned feature bundle that is enabled by a corresponding `use VERSION` declaration there may be concerns that the names collide with functions provided by `List::Util` or similar modules. As the intention of these operators is to provide the same behaviour, this is not considered a major problem. Differences due to caller scope as outlined above may be surprising to a small number of users.
5658

@@ -60,7 +62,7 @@ In the longer term, if these named features become part of a versioned feature b
6062

6163
```perl
6264
use v5.40;
63-
use feature 'any';
65+
use feature qw( any );
6466

6567
if( any { $_ > 10 } 5, 10, 15, 20 ) { say "A number above 10" }
6668
```
@@ -114,10 +116,6 @@ In any case, as junctions behave like values, they do not require special syntax
114116

115117
## Open Issues
116118

117-
* There could be anything up to five new operators added by this idea. Do they all get their own named feature flags? Do they all live under one flag?
118-
119-
* Should the flag be called `any`? That might be confusing as compared to the `:any` import tag which would request all features.
120-
121119
## Copyright
122120

123121
Copyright (C) 2024, Paul Evans.

0 commit comments

Comments
 (0)