diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-11-04 11:33:12 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-11-04 11:33:12 +0000 |
commit | d83f38d8facaed626f27ae5d9f0f66709664dc5e (patch) | |
tree | ed3341f90e73653352b8bc4c1b235cd2d5077daf /pod | |
parent | 2b6765935f5ee68d8093e686b8e292ad5de5a898 (diff) | |
download | perl-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 'pod')
-rw-r--r-- | pod/perl5112delta.pod | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/pod/perl5112delta.pod b/pod/perl5112delta.pod index b2a6522b02..aea02f3829 100644 --- a/pod/perl5112delta.pod +++ b/pod/perl5112delta.pod @@ -15,11 +15,28 @@ XXX Unlikely to need this section. =head1 Incompatible Changes -XXX For a release on a stable branch, this section aspires to be: +=head2 Use of C<:=> to mean an empty attribute list is now deprecated. - There are no changes intentionally incompatible with 5.XXX.XXX. If any - exist, they are bugs and reports are welcome. +An accident of Perl's parser means that these constructions are all equivalent: + my $pi := 4; + my $pi : = 4; + my $pi : = 4; + +with the C<:> being treated as the start of an attribute list, which ends +before the C<=>. As whitespace is not significant here, all are parsed as an +empty attribute list, hence all the above are equivalent to, and better written +as + + my $pi = 4; + +because no attribute processing is done for an empty list. + +As is, this means that C<:=> cannot be used as a new token, without silently +changing the meaning of existing code. Hence that particular form is now +deprecated, and will become a syntax error. If it is absolutely necessary to +have empty attribute lists (for example, because of a code generator) the +avoid the warning by adding a space before the C<=>. =head1 Core Enhancements |