Skip to content

Commit c217aa7

Browse files
committed
perldiag: Update text about '{' warnings/death
1 parent ded8ea4 commit c217aa7

File tree

1 file changed

+5
-78
lines changed

1 file changed

+5
-78
lines changed

pod/perldiag.pod

Lines changed: 5 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -6476,80 +6476,14 @@ also be escaped to avoid confusing the parser, for example,
64766476

64776477
qr{abc\{def\}ghi}
64786478

6479-
Forcing literal C<"{"> characters to be escaped will enable the Perl
6479+
Forcing literal C<"{"> characters to be escaped enables the Perl
64806480
language to be extended in various ways in future releases. To avoid
64816481
needlessly breaking existing code, the restriction is is not enforced in
64826482
contexts where there are unlikely to ever be extensions that could
64836483
conflict with the use there of C<"{"> as a literal. Those that are
6484-
not potentially ambiguous do not warn; those that are do raise a
6485-
non-deprecation warning.
6486-
6487-
In this release of Perl, some literal uses of C<"{"> are fatal, and some
6488-
still just deprecated. This is because of an oversight: some uses of a
6489-
literal C<"{"> that should have raised a deprecation warning starting in
6490-
v5.20 did not warn until v5.26. By making the already-warned uses fatal
6491-
now, some of the planned extensions can be made to the language sooner.
6492-
The cases which are still allowed will be fatal in Perl 5.32.
6493-
6494-
The contexts where no warnings or errors are raised are:
6495-
6496-
=over 4
6497-
6498-
=item *
6499-
6500-
as the first character in a pattern, or following C<"^"> indicating to
6501-
anchor the match to the beginning of a line.
6502-
6503-
=item *
6504-
6505-
as the first character following a C<"|"> indicating alternation.
6506-
6507-
=item *
6508-
6509-
as the first character in a parenthesized grouping like
6510-
6511-
/foo({bar)/
6512-
/foo(?:{bar)/
6513-
6514-
=item *
6515-
6516-
as the first character following a quantifier
6517-
6518-
/\s*{/
6519-
6520-
=back
6521-
6522-
=for comment
6523-
The text of the message above is duplicated below to allow splain (and
6524-
'use diagnostics') to work. Since one is deprecated, and one not, khw
6525-
thinks they can't be combined as one message.
6526-
6527-
=item Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.32), passed through in regex; marked by S<<-- HERE> in m/%s/
6528-
6529-
(D deprecated, regexp) The simple rule to remember, if you want to
6530-
match a literal C<"{"> character (U+007B C<LEFT CURLY BRACKET>) in a
6531-
regular expression pattern, is to escape each literal instance of it in
6532-
some way. Generally easiest is to precede it with a backslash, like
6533-
C<"\{"> or enclose it in square brackets (C<"[{]">). If the pattern
6534-
delimiters are also braces, any matching right brace (C<"}">) should
6535-
also be escaped to avoid confusing the parser, for example,
6536-
6537-
qr{abc\{def\}ghi}
6538-
6539-
Forcing literal C<"{"> characters to be escaped will enable the Perl
6540-
language to be extended in various ways in future releases. To avoid
6541-
needlessly breaking existing code, the restriction is is not enforced in
6542-
contexts where there are unlikely to ever be extensions that could
6543-
conflict with the use there of C<"{"> as a literal. Those that are
6544-
not potentially ambiguous do not warn; those that are do raise a
6545-
non-deprecation warning.
6546-
6547-
In this release of Perl, some literal uses of C<"{"> are fatal, and some
6548-
still just deprecated. This is because of an oversight: some uses of a
6549-
literal C<"{"> that should have raised a deprecation warning starting in
6550-
v5.20 did not warn until v5.26. By making the already-warned uses fatal
6551-
now, some of the planned extensions can be made to the language sooner.
6552-
The cases which are still allowed will be fatal in Perl 5.32.
6484+
not potentially ambiguous do not warn; those that are raise this
6485+
warning. This makes sure that an inadvertent typo doesn't silently
6486+
cause the pattern to compile to something unintended.
65536487

65546488
The contexts where no warnings or errors are raised are:
65556489

@@ -6598,21 +6532,14 @@ also be escaped to avoid confusing the parser, for example,
65986532

65996533
qr{abc\{def\}ghi}
66006534

6601-
Forcing literal C<"{"> characters to be escaped will enable the Perl
6535+
Forcing literal C<"{"> characters to be escaped enables the Perl
66026536
language to be extended in various ways in future releases. To avoid
66036537
needlessly breaking existing code, the restriction is is not enforced in
66046538
contexts where there are unlikely to ever be extensions that could
66056539
conflict with the use there of C<"{"> as a literal. Those that are
66066540
not potentially ambiguous do not warn; those that are do raise a
66076541
non-deprecation warning.
66086542

6609-
In this release of Perl, some literal uses of C<"{"> are fatal, and some
6610-
still just deprecated. This is because of an oversight: some uses of a
6611-
literal C<"{"> that should have raised a deprecation warning starting in
6612-
v5.20 did not warn until v5.26. By making the already-warned uses fatal
6613-
now, some of the planned extensions can be made to the language sooner.
6614-
The cases which are still allowed will be fatal in Perl 5.32.
6615-
66166543
The contexts where no warnings or errors are raised are:
66176544

66186545
=over 4

0 commit comments

Comments
 (0)