develooper Front page | perl.perl5.changes | Postings from November 2010

[perl.git] branch blead, updated. v5.13.7-177-gc2e0289

From:
Father Chrysostomos
Date:
November 28, 2010 13:17
Subject:
[perl.git] branch blead, updated. v5.13.7-177-gc2e0289
Message ID:
E1PMocc-0004wy-Kc@camel.ams6.corp.booking.com
In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/c2e0289ec9c3ceb8a52335bf8446b9abc61434bb?hp=71f155bffeaddb2eb47b6eeacc004116b3de1bb6>

- Log -----------------------------------------------------------------
commit c2e0289ec9c3ceb8a52335bf8446b9abc61434bb
Author: Father Chrysostomos <sprout@cpan.org>
Date:   Sun Nov 28 12:43:03 2010 -0800

    perldelta for d54f8cf785

M	pod/perldelta.pod

commit 2dc78664124f51814246e5b3da10c8a9f5fe2726
Author: Nicholas Clark <nick@ccl4.org>
Date:   Fri Nov 26 15:53:56 2010 +0000

    Make my $pi := 4; a syntax error.
    
    Previously it interpreted := as an empty attribute list, and issued a
    deprecation warning. This change permits := to be used as a binding operator.

M	dist/B-Deparse/t/deparse.t
M	pod/perldelta.pod
M	pod/perldiag.pod
M	t/lib/warnings/toke
M	t/op/attrs.t
M	toke.c

commit d42388159bbfea27efd2de1d76aa62e99f6c8240
Author: Father Chrysostomos <sprout@cpan.org>
Date:   Sun Nov 28 11:05:29 2010 -0800

    perldelta for 75f5d3312

M	pod/perldelta.pod
-----------------------------------------------------------------------

Summary of changes:
 dist/B-Deparse/t/deparse.t |    3 +-
 pod/perldelta.pod          |   26 +++++++++++++++---
 pod/perldiag.pod           |   14 ++++++----
 t/lib/warnings/toke        |   59 --------------------------------------------
 t/op/attrs.t               |   57 +++++++++++++++++++++++++++++++++++++++++-
 toke.c                     |    3 +-
 6 files changed, 88 insertions(+), 74 deletions(-)

diff --git a/dist/B-Deparse/t/deparse.t b/dist/B-Deparse/t/deparse.t
index 3ae14e9..38ce876 100644
--- a/dist/B-Deparse/t/deparse.t
+++ b/dist/B-Deparse/t/deparse.t
@@ -619,7 +619,8 @@ foreach (0..3) {
 # no attribute list
 my $pi = 4;
 ####
-# := empty attribute list
+# SKIP ?$] > 5.013006 && ":= is now a syntax error"
+# := treated as an empty attribute list
 no warnings;
 my $pi := 4;
 >>>>
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 68d074b..143cd0a 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -1,7 +1,7 @@
 =encoding utf8
 
 =for comment
-This has been completed up to 8e747b69.
+This has been completed up to d54f8cf785.
 
 =head1 NAME
 
@@ -67,12 +67,20 @@ L</Selected Bug Fixes> section.
 
 =head1 Incompatible Changes
 
-XXX For a release on a stable branch, this section aspires to be:
+=head2 Attempting to use C<:=> as an empty attribute list is now a syntax error
 
-    There are no changes intentionally incompatible with 5.XXX.XXX. If any
-    exist, they are bugs and reports are welcome.
+Previously C<my $pi := 4;> was exactly equivalent to C<my $pi : = 4;>,
+with the C<:> being treated as the start of an attribute list, ending before
+the C<=>. The use of C<:=> to mean C<: => was deprecated in 5.12.0, and is now
+a syntax error. This will allow the future use of C<:=> as a new token.
 
-[ List each incompatible change as a =head2 entry ]
+We find no Perl 5 code on CPAN using this construction, outside the core's
+tests for it, so we believe that this change will have very little impact on
+real-world codebases.
+
+If it is absolutely necessary to have empty attribute lists (for example,
+because of a code generator) then avoid the warning by adding a space
+before the C<=>.
 
 =head1 Deprecations
 
@@ -171,12 +179,20 @@ It has several new functions for handling IPv6 addresses.
 
 =item *
 
+C<Time::HiRes> has been upgraded from 1.9721 to 1.9721_01.
+
+=item *
+
 C<Unicode::Collate> has been upgraded from 0.67 to 0.68
 
 =item *
 
 C<Unicode::UCD> has been upgraded from 0.29 to 0.30.
 
+=item *
+
+C<version> has been upgraded from 0.82 to 0.86.
+
 =back
 
 =head2 Removed Modules and Pragmata
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index c186919..7250057 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -4991,13 +4991,15 @@ modifier is not presently meaningful in substitutions.
 use the /g modifier.  Currently, /c is meaningful only when /g is
 used.  (This may change in the future.)
 
-=item Use of := for an empty attribute list is deprecated
+=item Use of := for an empty attribute list is not allowed
 
-(D deprecated) The construction C<my $x := 42> currently
-parses correctly in perl, being equivalent to C<my $x : = 42>
-(applying an empty attribute list to C<$x>). This useless
-construct is now deprecated, so C<:=> can be reclaimed as a new
-operator in the future.
+(F) The construction C<my $x := 42> used to parse as equivalent to
+C<my $x : = 42> (applying an empty attribute list to C<$x>).
+This construct was deprecated in 5.12.0, and has now been made a syntax
+error, so C<:=> can be reclaimed as a new operator in the future.
+
+If you need an empty attribute list, for example in a code generator, add
+a space before the C<=>.
 
 =item Use of ?PATTERN? without explicit operator is deprecated
 
diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke
index 7096620..5468ef0 100644
--- a/t/lib/warnings/toke
+++ b/t/lib/warnings/toke
@@ -909,65 +909,6 @@ Possible unintended interpolation of $\ in regex at - line 3.
 Possible unintended interpolation of $\ in regex at - line 5.
 ########
 # toke.c
-use feature 'state';
-# This one is fine as an empty attribute list
-my $holy_Einstein : = '';
-# This one is deprecated
-my $krunch := 4;
-our $FWISK_FWISK_FWIZZACH_FWACH_ZACHITTY_ZICH_SHAZZATZ_FWISK := '';
-state $thump := 'Trumpets';
-# Lather rinse repeat in my usual obsessive style
-my @holy_perfect_pitch : = ();
-my @zok := ();
-our @GUKGUK := ();
-# state @widget_mark := ();
-my %holy_seditives : = ();
-my %bang := ();
-our %GIGAZING := ();
-# state %hex := ();
-no warnings 'deprecated';
-my $holy_giveaways : = '';
-my $eee_yow := [];
-our $TWOYYOYYOING_THUK_UGH := 1 == 1;
-state $octothorn := 'Tinky Winky';
-my @holy_Taj_Mahal : = ();
-my @touche := ();
-our @PLAK_DAK_THUK_FRIT := ();
-# state @hash_mark := ();
-my %holy_priceless_collection_of_Etruscan_snoods : = ();
-my %wham_eth := ();
-our %THWUK := ();
-# state %octalthorpe := ();
-use warnings;
-my $holy_sewer_pipe : = '';
-my $thunk := undef;
-our $BLIT := time;
-state $crunch := 'Laa Laa';
-my @glurpp := ();
-my @holy_harem : = ();
-our @FABADAP := ();
-# state @square := ();
-my %holy_pin_cushions : = ();
-my %swoosh := ();
-our %RRRRR := ();
-# state %scratchmark := ();
-EXPECT
-Use of := for an empty attribute list is deprecated at - line 6.
-Use of := for an empty attribute list is deprecated at - line 7.
-Use of := for an empty attribute list is deprecated at - line 8.
-Use of := for an empty attribute list is deprecated at - line 11.
-Use of := for an empty attribute list is deprecated at - line 12.
-Use of := for an empty attribute list is deprecated at - line 15.
-Use of := for an empty attribute list is deprecated at - line 16.
-Use of := for an empty attribute list is deprecated at - line 33.
-Use of := for an empty attribute list is deprecated at - line 34.
-Use of := for an empty attribute list is deprecated at - line 35.
-Use of := for an empty attribute list is deprecated at - line 36.
-Use of := for an empty attribute list is deprecated at - line 38.
-Use of := for an empty attribute list is deprecated at - line 41.
-Use of := for an empty attribute list is deprecated at - line 42.
-########
-# toke.c
 use warnings 'syntax' ;
 my $a = "\o";
 my $a = "\o{";
diff --git a/t/op/attrs.t b/t/op/attrs.t
index 3013893..4e1a4c3 100644
--- a/t/op/attrs.t
+++ b/t/op/attrs.t
@@ -14,8 +14,6 @@ BEGIN {
 
 use warnings;
 
-plan 92;
-
 $SIG{__WARN__} = sub { die @_ };
 
 sub eval_ok ($;$) {
@@ -243,3 +241,58 @@ ok !defined(attributes::get(\PVBM)),
 	$c=undef; eval 'sub t5 :Foo { }';
 	main::ok $c == \&{"t5"} && $c == $t5b && $c == $t5a;
 }
+
+my @tests = grep {/^[^#]/} split /\n/, <<'EOT';
+# This one is fine as an empty attribute list
+my $holy_Einstein : = '';
+# This one is deprecated
+my $krunch := 4;
+our $FWISK_FWISK_FWIZZACH_FWACH_ZACHITTY_ZICH_SHAZZATZ_FWISK := '';
+state $thump := 'Trumpets';
+# Lather rinse repeat in my usual obsessive style
+my @holy_perfect_pitch : = ();
+my @zok := ();
+our @GUKGUK := ();
+# state @widget_mark := ();
+my %holy_seditives : = ();
+my %bang := ();
+our %GIGAZING := ();
+# state %hex := ();
+my $holy_giveaways : = '';
+my $eee_yow := [];
+our $TWOYYOYYOING_THUK_UGH := 1 == 1;
+state $octothorn := 'Tinky Winky';
+my @holy_Taj_Mahal : = ();
+my @touche := ();
+our @PLAK_DAK_THUK_FRIT := ();
+# state @hash_mark := ();
+my %holy_priceless_collection_of_Etruscan_snoods : = ();
+my %wham_eth := ();
+our %THWUK := ();
+# state %octalthorpe := ();
+my $holy_sewer_pipe : = '';
+my $thunk := undef;
+our $BLIT := time;
+state $crunch := 'Laa Laa';
+my @glurpp := ();
+my @holy_harem : = ();
+our @FABADAP := ();
+# state @square := ();
+my %holy_pin_cushions : = ();
+my %swoosh := ();
+our %RRRRR := ();
+# state %scratchmark := ();
+EOT
+
+foreach my $test (@tests) {
+    use feature 'state';
+    eval $test;
+    if ($test =~ /:=/) {
+	like $@, qr/Use of := for an empty attribute list is not allowed/,
+	    "Parse error for q{$test}";
+    } else {
+	is $@, '', "No error for q{$test}";
+    }
+}
+
+done_testing();
diff --git a/toke.c b/toke.c
index 584aea0..d2868c2 100644
--- a/toke.c
+++ b/toke.c
@@ -5228,7 +5228,8 @@ Perl_yylex(pTHX)
 		break;
 	    PL_bufptr = s;	/* update in case we back off */
 	    if (*s == '=') {
-		deprecate(":= for an empty attribute list");
+		Perl_croak(aTHX_
+			   "Use of := for an empty attribute list is not allowed");
 	    }
 	    goto grabattrs;
 	case XATTRBLOCK:

--
Perl5 Master Repository



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About