Skip to content

Commit acab242

Browse files
committed
Remove deprecated literal control char variable names
These were deprecated in v5.20
1 parent b3632c7 commit acab242

File tree

4 files changed

+12
-41
lines changed

4 files changed

+12
-41
lines changed

pod/perldelta.pod

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ L</Selected Bug Fixes> section.
3232

3333
[ List each security issue as a =head2 entry ]
3434

35-
=head1 Incompatible Changes
35+
=head2 Literal control character variable names are no longer permissible
36+
37+
A variable name may no longer contain a literal control character under
38+
any circumstances. These previously were allowed in single-character
39+
names on ASCII platforms, but have been deprecated there since Perl
40+
v5.20. This affects things like C<$I<\cT>>, where I<\cT> is a literal
41+
control (such as a C<NAK> or C<NEGATIVE ACKNOWLEDGE> character) in the
42+
source code.
3643

3744
=head2 C<NBSP> is no longer permissible in C<\N{...}>
3845

pod/perldiag.pod

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6808,21 +6808,6 @@ only C. This usually means there's a better way to do it in Perl.
68086808
generally because there's a better way to do it, and also because the
68096809
old way has bad side effects.
68106810

6811-
=item Use of literal control characters in variable names is deprecated
6812-
6813-
=item Use of literal non-graphic characters in variable names is deprecated
6814-
6815-
(D deprecated) Using literal non-graphic (including control)
6816-
characters in the source to refer to the ^FOO variables, like C<$^X> and
6817-
C<${^GLOBAL_PHASE}> is now deprecated. (We use C<^X> and C<^G> here for
6818-
legibility. They actually represent the non-printable control
6819-
characters, code points 0x18 and 0x07, respectively; C<^A> would mean
6820-
the control character whose code point is 0x01.) This only affects
6821-
code like C<$\cT>, where C<\cT> is a control in the source code; C<${"\cT"}> and
6822-
C<$^T> remain valid. Things that are non-controls and also not graphic
6823-
are NO-BREAK SPACE and SOFT HYPHEN, which were previously only allowed
6824-
for historical reasons.
6825-
68266811
=item Use of -l on filehandle%s
68276812

68286813
(W io) A filehandle represents an opened file, and when you opened the file

t/uni/variables.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ for ( 0x0 .. 0xff ) {
106106
else {
107107
$name = sprintf "\\x%02x, a C1 control", $ord;
108108
}
109-
$syntax_error = $::IS_EBCDIC;
109+
$syntax_error = 1;
110110
$deprecated = ! $syntax_error;
111111
}
112112
elsif ($chr =~ /\p{XIDStart}/) {
113113
$name = sprintf "\\x%02x, a non-ASCII XIDS character", $ord;
114114
}
115115
elsif ($chr =~ /\p{XPosixSpace}/) {
116116
$name = sprintf "\\x%02x, a non-ASCII space character", $ord;
117-
$syntax_error = $::IS_EBCDIC;
117+
$syntax_error = 1;
118118
$deprecated = ! $syntax_error;
119119
}
120120
else {

toke.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8896,21 +8896,12 @@ S_scan_word(pTHX_ char *s, char *dest, STRLEN destlen, int allow_package, STRLEN
88968896
*
88978897
* Because all ASCII characters have the same representation whether
88988898
* encoded in UTF-8 or not, we can use the foo_A macros below and '\0' and
8899-
* '{' without knowing if is UTF-8 or not.
8900-
* EBCDIC already uses the rules that ASCII platforms will use after the
8901-
* deprecation cycle; see comment below about the deprecation. */
8902-
#ifdef EBCDIC
8903-
# define VALID_LEN_ONE_IDENT(s, is_utf8) \
8899+
* '{' without knowing if is UTF-8 or not. */
8900+
#define VALID_LEN_ONE_IDENT(s, is_utf8) \
89048901
(isGRAPH_A(*(s)) || ((is_utf8) \
89058902
? isIDFIRST_utf8((U8*) (s)) \
89068903
: (isGRAPH_L1(*s) \
89078904
&& LIKELY((U8) *(s) != LATIN1_TO_NATIVE(0xAD)))))
8908-
#else
8909-
# define VALID_LEN_ONE_IDENT(s, is_utf8) \
8910-
(isGRAPH_A(*(s)) || ((is_utf8) \
8911-
? isIDFIRST_utf8((U8*) (s)) \
8912-
: ! isASCII_utf8((U8*) (s))))
8913-
#endif
89148905

89158906
STATIC char *
89168907
S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni)
@@ -8975,18 +8966,6 @@ S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni)
89758966
: 1)
89768967
&& VALID_LEN_ONE_IDENT(s, is_utf8))
89778968
{
8978-
/* Deprecate all non-graphic characters. Include SHY as a non-graphic,
8979-
* because often it has no graphic representation. (We can't get to
8980-
* here with SHY when 'is_utf8' is true, so no need to include a UTF-8
8981-
* test for it.) */
8982-
if ((is_utf8)
8983-
? ! isGRAPH_utf8( (U8*) s)
8984-
: (! isGRAPH_L1( (U8) *s)
8985-
|| UNLIKELY((U8) *(s) == LATIN1_TO_NATIVE(0xAD))))
8986-
{
8987-
deprecate("literal non-graphic characters in variable names");
8988-
}
8989-
89908969
if (is_utf8) {
89918970
const STRLEN skip = UTF8SKIP(s);
89928971
STRLEN i;

0 commit comments

Comments
 (0)