In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/c263379c498269adb3a24d6d48aec4e822fde5c7?hp=353075a07ebc959a3a5d83bf53b00f3d2664ed00>

- Log -----------------------------------------------------------------
commit c263379c498269adb3a24d6d48aec4e822fde5c7
Author: Father Chrysostomos <[email protected]>
Date:   Sun Nov 16 16:36:46 2014 -0800

    perldelta for fd2709db56

M       pod/perldelta.pod

commit 697c599164e16f907e5d150276790f8e533765ed
Author: Father Chrysostomos <[email protected]>
Date:   Sun Nov 16 16:34:36 2014 -0800

    perldelta for d88d1fe0d

M       pod/perldelta.pod

commit 1861205d8d41bb44ba0d82bba8639e56e29e7544
Author: Father Chrysostomos <[email protected]>
Date:   Sun Nov 16 16:32:41 2014 -0800

    perldelta for ddc3d23f07

M       pod/perldelta.pod

commit 0ef4323aa6d82c92679bcb53da063cd1531991ac
Author: Father Chrysostomos <[email protected]>
Date:   Sun Nov 16 16:31:03 2014 -0800

    perldelta for 659fbb76ee

M       pod/perldelta.pod

commit c7f058f0f596280c857674767e2113c7bd6681da
Author: Father Chrysostomos <[email protected]>
Date:   Sun Nov 16 16:30:27 2014 -0800

    perldelta for fbc76eb33c6

M       pod/perldelta.pod

commit 9f122eef406657984a7e0f19e8e92c05fcd777b9
Author: Father Chrysostomos <[email protected]>
Date:   Sun Nov 16 16:28:52 2014 -0800

    perldelta for c74d82e0fe

M       pod/perldelta.pod

commit 179c70e5340c602eec1230699d2a315be3580053
Author: Father Chrysostomos <[email protected]>
Date:   Sun Nov 16 16:06:16 2014 -0800

    perldelta: missing paren

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

Summary of changes:
 pod/perldelta.pod | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 98 insertions(+), 1 deletion(-)

diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 45d6dab..9646f37 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -113,6 +113,49 @@ The practical effect of this occurs only when not under 
C<S<"use
 utf8">>, and affects just the C1 controls (code points 0x80 through
 0xFF), NO-BREAK SPACE, and SOFT HYPHEN.
 
+=head2 Inlining of C<sub () { $var }> with observable side-effects
+
+In many cases Perl makes sub () { $var } into an inlinable constant
+subroutine, capturing the value of $var at the time the C<sub> expression
+is evaluated.  This can break the closure behaviour in those cases where
+$var is subsequently modified.  The subroutine won't return the new value.
+
+This usage is now deprecated in those cases where the variable could be
+modified elsewhere.  Perl detects those cases and emits a deprecation
+warning.  Such code will likely change in the future and stop producing a
+constant.
+
+If your variable is only modified in the place where it is declared, then
+Perl will continue to make the sub inlinable with no warnings.
+
+    sub make_constant {
+        my $var = shift;
+        return sub () { $var }; # fine
+    }
+
+    sub make_constant_deprecated {
+        my $var;
+        $var = shift;
+        return sub () { $bar }; # deprecated
+    }
+
+    sub make_constant_deprecated2 {
+        my $var = shift;
+        log_that_value($var); # could modify $var
+        return sub () { $bar }; # deprecated
+    }
+
+In the second example above, detecting that $var is assigned to only once
+is too hard to detect.  That it happens in a spot other than the C<my>
+declaration is enough for Perl to find it suspicious.
+
+This deprecation warning happens only for a simple variable for the body of
+the sub.  (A C<BEGIN> block or C<use> statement inside the sub is ignored,
+because it does not become part of the sub's body.)  For more complex
+cases, such as C<sub () { do_something() if 0; $var }> the behaviour has
+changed such that inlining does not happen if the variable is modifiable
+elsewhere.  Such cases should be rare.
+
 =head1 Performance Enhancements
 
 XXX Changes which enhance performance without changing behaviour go here.
@@ -197,6 +240,9 @@ before Perl 5.22.  [perl #77452]
 B::Deparse no longer puts erroneous C<local> here and there, such as for
 C<LIST = tr/a//d>.  [perl #119815]
 
+Adjacent C<use> statements are no longer accidentally nested if one
+contains a C<do> block.  [perl #115066]
+
 =item *
 
 L<B::Op_private> has been upgraded from version 5.021005 to 5.021006.
@@ -335,6 +381,12 @@ This message has had the S<"<-- HERE"> marker removed, as 
it was always
 placed at the end of the regular expression, regardless of where the
 problem actually occurred.  [perl #122680]
 
+=item *
+
+L<Setting $E<sol> to a reference to %s as a form of slurp is deprecated, 
treating as undef|perldiag/"Setting $/ to a reference to %s as a form of slurp 
is deprecated, treating as undef">
+
+This warning is now a default warning, like other deprecation warnings.
+
 =back
 
 =head1 Utility Changes
@@ -585,7 +637,7 @@ were an object with "x" overloading, causing erratic 
behaviour.
 =item *
 
 Assignment to a lexical scalar is often optimised away (as mentioned under
-L</Performance Enhancements>.  Various bugs related to this optimisation
+L</Performance Enhancements>).  Various bugs related to this optimisation
 have been fixed.  Certain operators on the right-hand side would sometimes
 fail to assign the value at all or assign the wrong value, or would call
 STORE twice or not at all on tied variables.  The operators affected were
@@ -608,6 +660,51 @@ to mean C<setpgrp(0)>.  This has been fixed.
 C<__SUB__> could return the wrong value or even corrupt memory under the
 debugger (the B<-d> switch) and in subs containing C<eval $string>.
 
+=item *
+
+When C<sub () { $var }> becomes inlinable, it now returns a different
+scalar each time, just as a non-inlinable sub would, though Perl still
+optimises the copy away in cases where it would make no observable
+difference.
+
+=item *
+
+C<my sub f () { $var }> and C<sub () : attr { $var }> are no longer
+eligible for inlining.  The former would crash; the latter would just
+throw the attributes away.  An exception is made for the little-known
+":method" attribute, which does nothing much.
+
+=item *
+
+Inlining of subs with an empty prototype is now more consistent than
+before.  Previously, a sub with multiple statements, all but the last
+optimised away, would be inlinable only if it were an anonymous sub
+containing a string C<eval> or C<state> declaration or closing over an
+outer lexical variable (or any anonymous sub under the debugger).  Now any
+sub that gets folded to a single constant after statements have been
+optimised away is eligible for inlining.  This applies to things like C<sub
+() { jabber() if DEBUG; 42 }>.
+
+Some subroutines with an explicit C<return> were being made inlinable,
+contrary to the documentation,  Now C<return> always prevents inlining.
+
+=item *
+
+On some systems, such as VMS, C<crypt> can return a non-ASCII string.  If a
+scalar assigned to had contained a UTF8 string previously, then C<crypt>
+would not turn off the UTF8 flag, thus corrupting the return value.  This
+would happen with C<$lexical = crypt ...>. 
+
+=item *
+
+C<crypt> no longer calls C<FETCH> twice on a tied first argument.
+
+=item *
+
+An unterminated here-doc on the last line of a quote-like operator
+(C<qq[${ <<END }]>, C</(?{ <<END })/>) no longer causes a double free.  It
+started doing so in 5.18.
+
 =back
 
 =head1 Known Problems

--
Perl5 Master Repository

Reply via email to