From 4c32f29ba9da41e214e9e03a44a530ee0427f19a Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Fri, 1 Dec 2000 19:44:44 +0000 Subject: [PATCH] Retract #7941. Forbidding subs m/s/etc is too cruel because that also breaks using them as methods. p4raw-id: //depot/perl@7943 --- pod/perldiag.pod | 7 ------- t/op/misc.t | 4 ---- toke.c | 25 ------------------------- 3 files changed, 36 deletions(-) diff --git a/pod/perldiag.pod b/pod/perldiag.pod index abe0579..9baf175 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -3121,13 +3121,6 @@ C may break this. eval "sub name { ... }"; } -=item Subroutine name %s reserved for string operators - -(F) Certain string operators can be called with a very similar syntax -to a function call, and therefore to avoid confusion their names are -reserved and cannot be used as subroutine names. The reserved names -are: C. - =item Substitution loop (P) The substitution was looping infinitely. (Obviously, a substitution diff --git a/t/op/misc.t b/t/op/misc.t index 6d05046..aea14c8 100755 --- a/t/op/misc.t +++ b/t/op/misc.t @@ -595,7 +595,3 @@ for (@locales) { print "$_ $s\n"; } EXPECT -######## -sub m {} -EXPECT -Subroutine name "m" reserved for string operators at - line 1. diff --git a/toke.c b/toke.c index c759650..90b5ad5 100644 --- a/toke.c +++ b/toke.c @@ -4888,8 +4888,6 @@ Perl_yylex(pTHX) if (isIDFIRST_lazy_if(s,UTF) || *s == '\'' || (*s == ':' && s[1] == ':')) { - bool reserved = FALSE; - PL_expect = XBLOCK; attrful = XATTRBLOCK; /* remember buffer pos'n for later force_word */ @@ -4904,29 +4902,6 @@ Perl_yylex(pTHX) } s = skipspace(d); have_name = TRUE; - switch (tmpbuf[0]) { - case 'm': - case 's': - case 'y': - if (tmpbuf[1] == 0) - reserved = TRUE; - break; - case 'q': - if (tmpbuf[1] == 0 || - (strchr("qwxr", tmpbuf[1]) && tmpbuf[2] == 0)) - reserved = TRUE; - break; - case 't': - if (tmpbuf[1] == 'r' && tmpbuf[2] == 0) - reserved = TRUE; - break; - default: - break; - } - if (reserved) - Perl_croak(aTHX_ - "Subroutine name \"%s\" reserved for string operators", - tmpbuf); } else { if (key == KEY_my) -- 2.7.4