summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-11-04 11:33:12 +0000
committerNicholas Clark <nick@ccl4.org>2009-11-04 11:33:12 +0000
commitd83f38d8facaed626f27ae5d9f0f66709664dc5e (patch)
treeed3341f90e73653352b8bc4c1b235cd2d5077daf /toke.c
parent2b6765935f5ee68d8093e686b8e292ad5de5a898 (diff)
downloadperl-d83f38d8facaed626f27ae5d9f0f66709664dc5e.tar.gz
Deprecate use of := to mean an empty attribute list in my $pi := 4;
An accident of Perl's parser meant that my $pi := 4; was parsed as an empty attribute list. Empty attribute lists are ignored, hence the above is equivalent to my $pi = 4; However, the fact that it is currently valid syntax means that := cannot be used as new token, without silently changing the meaning of existing code. Hence it is now deprecated, so that it can subsequently be removed, allowing the possibility of := to be used as a new token with new semantics.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/toke.c b/toke.c
index bd20434753..fa78415331 100644
--- a/toke.c
+++ b/toke.c
@@ -4298,6 +4298,9 @@ Perl_yylex(pTHX)
if (!PL_in_my || PL_lex_state != LEX_NORMAL)
break;
PL_bufptr = s; /* update in case we back off */
+ if (*s == '=') {
+ deprecate(":= for an empty attribute list");
+ }
goto grabattrs;
case XATTRBLOCK:
PL_expect = XBLOCK;