You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ppcs/ppc0027-any-and-all.md
+5-7Lines changed: 5 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -19,9 +19,11 @@ Most code of any appreciable size tends to make use of at least the `any` or `al
19
19
20
20
## Specification
21
21
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`:
23
23
24
24
```perl
25
+
use feature qw( any all );
26
+
25
27
any { BLOCK } LIST
26
28
27
29
all { BLOCK } LIST
@@ -50,7 +52,7 @@ Some::Class->new(
50
52
51
53
## Backwards Compatibility
52
54
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.
54
56
55
57
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.
56
58
@@ -60,7 +62,7 @@ In the longer term, if these named features become part of a versioned feature b
60
62
61
63
```perl
62
64
use v5.40;
63
-
use feature 'any';
65
+
use feature qw(any);
64
66
65
67
if( any { $_ > 10 } 5, 10, 15, 20 ) { say"A number above 10" }
66
68
```
@@ -114,10 +116,6 @@ In any case, as junctions behave like values, they do not require special syntax
114
116
115
117
## Open Issues
116
118
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.
0 commit comments