This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta for 230834321 (renamed stashes; m??; reset)
[perl5.git] / pod / perldelta.pod
index c1854b4..683e490 100644 (file)
@@ -5,15 +5,15 @@
 [ this is a template for a new perldelta file.  Any text flagged as XXX needs
 to be processed before release. ]
 
-perldelta - what is new for perl v5.17.4
+perldelta - what is new for perl v5.17.7
 
 =head1 DESCRIPTION
 
-This document describes differences between the 5.17.3 release and the 5.17.4
+This document describes differences between the 5.17.6 release and the 5.17.7
 release.
 
-If you are upgrading from an earlier release such as 5.17.2, first read
-L<perl5173delta>, which describes differences between 5.17.2 and 5.17.3.
+If you are upgrading from an earlier release such as 5.17.5, first read
+L<perl5176delta>, which describes differences between 5.17.5 and 5.17.6.
 
 =head1 Notice
 
@@ -21,36 +21,11 @@ XXX Any important notices here
 
 =head1 Core Enhancements
 
-XXX New core language features go here.  Summarize user-visible core language
-enhancements.  Particularly prominent performance optimisations could go
-here, but most should go in the L</Performance Enhancements> section.
+=head2 $&, $` and $' are no longer slow
 
-[ List each enhancement as a =head2 entry ]
-
-=head2 Latest Unicode 6.2 beta is included
-
-This is supposed to be the final data for 6.2, unless glitches are
-found.  The earlier experimental 6.2 beta data has been reverted, and
-this used instead.  Not all the changes that were proposed for 6.2 and
-that were in the earlier beta versions are actually going into 6.2.  In
-particular, there are no changes from 6.1 in the General_Category of any
-characters.  6.2 does revise the C<\X> handling for the REGIONAL
-INDICATOR characters that were added in Unicode 6.0.  Perl now for the
-first time fully handles this revision.
-
-=head2 New DTrace probes
-
-The following new DTrace probes have been added:
-
-=over 4
-
-=item C<op-entry>
-
-=item C<loading-file>
-
-=item C<loaded-file>
-
-=back
+These three infamous variables have been redeemed and no longer slow down
+your program when used.  Hence, the /p regular expression flag now does
+nothing.
 
 =head1 Security
 
@@ -62,13 +37,26 @@ L</Selected Bug Fixes> section.
 
 =head1 Incompatible Changes
 
-XXX For a release on a stable branch, this section aspires to be:
+=head2 readline() with C<$/ = \N> now reads N characters, not N bytes
+
+Previously, when reading from a stream with I/O layers such as
+C<encoding>, the readline() function, otherwise known as the C<< <> >>
+operator, would read I<N> bytes from the top-most layer. [perl #79960]
+
+Now, I<N> characters are read instead.
+
+There is no change in behaviour when reading from streams with no
+extra layers, since bytes map exactly to characters.
 
-    There are no changes intentionally incompatible with 5.XXX.XXX
-    If any exist, they are bugs, and we request that you submit a
-    report.  See L</Reporting Bugs> below.
+=head2 Lexical subroutine warnings have moved
 
-[ List each incompatible change as a =head2 entry ]
+The warning about the use of an experimental feature emitted when lexical
+subroutines (added in 5.17.4) are used now happens when the subroutine
+itself is declared, not when the "lexical_subs" feature is activated via
+C<use feature>.
+
+This stops C<use feature ':all'> from warning, but causes
+C<my sub foo; my sub bar> to warn twice.
 
 =head1 Deprecations
 
@@ -78,73 +66,93 @@ an updated module in the L</Modules and Pragmata> section.
 
 [ List each deprecation as a =head2 entry ]
 
-=head1 Performance Enhancements
+=head2 Lexical $_ is now deprecated
 
-XXX Changes which enhance performance without changing behaviour go here.
-There may well be none in a stable release.
+Since it was introduced in Perl 5.10, it has caused much confusion with no
+obvious solution:
 
-[ List each enhancement as a =item entry ]
-
-=over 4
+=over
 
 =item *
 
-Speed up in regular expression matching against Unicode properties.  The
-largest gain is for C<\X>, the Unicode "extended grapheme cluster".  The
-gain for it is about 35% - 40%.  Bracketed character classes, e.g.,
-C<[0-9\x{100}]> containing code points above 255 are also now faster.
+Various modules (e.g., List::Util) expect callback routines to use the
+global $_.  C<use List::Util 'first'; my $_; first { $_ == 1 } @list> does
+not work as one would expect.
 
 =item *
 
-On platforms supporting it, several former macros are now implemented as static
-inline functions. This should speed things up slightly on non-GCC platforms.
+A C<my $_> declaration earlier in the same file can cause confusing closure
+warnings.
 
 =item *
 
-Apply the optimisation of hashes in boolean context, such as in C<if> or C<and>,
-to constructs in non-void context.
+The "_" subroutine prototype character allows called subroutines to access
+your lexical $_, so it is not really private after all.
 
 =item *
 
-Extend the optimisation of hashes in boolean context to C<scalar(%hash)>,
-C<%hash ? ... : ...>, and C<sub { %hash || ... | }>.
+Nevertheless, subroutines with a "(@)" prototype and methods cannot access
+the caller's lexical $_, unless they are written in XS.
 
 =item *
 
-When making a copy of the string being matched against (so that $1, $& et al
-continue to show the correct value even if the original string is subsequently
-modified), only copy that substring of the original string needed for the
-capture variables, rather than copying the whole string.
-
-This is a big win for code like
-
-    $&;
-    $_ = 'x' x 1_000_000;
-    1 while /(.)/;
+But even XS routines cannot access a lexical $_ declared, not in the
+calling subroutine, but in an outer scope, iff that subroutine happened not
+to mention $_ or use any operators that default to $_.
 
-Also, when pessimizing if the code contains C<$`>, C<$&> or C<$'>, record the
-presence of each variable separately, so that the determination of the substring
-range is based on each variable separately. So performance-wise,
-
-   $&; /x/
-
-is now roughly equivalent to
-
-   /(x)/
+=back
 
-whereas previously it was like
+=head2 Various XS-callable functions are now deprecated
+
+The following functions will be removed from a future version of Perl,
+and should not be used.  With participating C compilers (e.g., gcc),
+compiling any file that uses any of these will generate a warning.
+These were not intended for public use; there are equivalent, faster,
+macros for most of them.  See L<perlapi/Character classes>:
+C<is_uni_ascii>,
+C<is_uni_ascii_lc>,
+C<is_uni_blank>,
+C<is_uni_blank_lc>,
+C<is_uni_cntrl>,
+C<is_uni_cntrl_lc>,
+C<is_uni_idfirst_lc>,
+C<is_uni_space>,
+C<is_uni_space_lc>,
+C<is_uni_xdigit>,
+C<is_uni_xdigit_lc>,
+C<is_utf8_ascii>,
+C<is_utf8_blank>,
+C<is_utf8_cntrl>,
+C<is_utf8_idcont>,
+C<is_utf8_idfirst>,
+C<is_utf8_perl_space>,
+C<is_utf8_perl_word>,
+C<is_utf8_posix_digit>,
+C<is_utf8_space>,
+C<is_utf8_xdigit>.
+C<is_utf8_xidcont>,
+C<is_utf8_xidfirst>,
+C<to_uni_lower_lc>,
+C<to_uni_title_lc>,
+and
+C<to_uni_upper_lc>.
 
-   /^(.*)(x)(.*)$/
+=head1 Performance Enhancements
 
-and
+XXX Changes which enhance performance without changing behaviour go here.
+There may well be none in a stable release.
 
-   $&; $'; /x/
+[ List each enhancement as a =item entry ]
 
-is now roughly equivalent to
+=over 4
 
-   /(x)(.*)$/
+=item *
 
-etc.
+Perl has a new copy-on-write mechanism that avoids the need to copy the
+internal string buffer when assigning from one scalar to another.  This
+makes copying large strings appear much faster.  Modifying one of the two
+(or more) strings after an assignment will force a copy internally.  This
+makes it unnecessary to pass strings by reference for efficiency.
 
 =back
 
@@ -176,93 +184,13 @@ XXX
 
 =item *
 
-L<Archive::Tar> has been upgraded from version 1.88 to 1.90.  This adds
-documentation fixes.
-
-=item *
-
-L<B> has been upgraded from version 1.37 to 1.38.  This makes the module work
-with the new pad API.
-
-=item *
-
-L<B::Concise> has been upgraded from version 0.92 to 0.93.  This adds support
-for the new C<OpMAYBE_TRUEBOOL> and C<OPpTRUEBOOL> flags.
-
-=item *
-
-L<B::Deparse> has been upgraded from version 1.16 to 1.17.  This suppresses
-trailing semicolons in formats.
-
-=item *
-
-L<DB_File> has been upgraded from version 1.826 to 1.827.  The main Perl module
-no longer uses the C<"@_"> construct.
-
-=item *
-
-L<Devel::Peek> has been upgraded from version 1.09 to 1.10.  This fixes
-compilation with C++ compilers and makes the module work with the new pad API.
-
-=item *
-
-L<DynaLoader> has been upgraded from version 1.15 to 1.16.  This fixes warnings
-about using C<CODE> sections without an C<OUTPUT> section.
-
-=item *
-
-L<ExtUtils::ParseXS> has been upgraded from version 3.17 to 3.18.  This avoids a
-bogus warning for initialised XSUB non-parameters.
-
-=item *
-
-L<File::Copy> has been upgraded from version 2.23 to 2.24.  C<copy()> no longer
-zeros files when copying into the same directory, and also now fails (as it has
-long been documented to do) when attempting to copy a file over itself.
-
-=item *
-
-L<File::Find> has been upgraded from version 1.21 to 1.22.  This fixes
-inconsistent unixy path handling on VMS.
-
-=item *
-
-L<Locale::Codes> has been upgraded from version 3.22 to 3.23.  It includes some
-new codes.
-
-=item *
-
-L<Module::CoreList> has been upgraded from version 2.71 to 2.73.  This restores
-compatibility with older versions of perl and cleans up the corelist data for
-various modules.
-
-=item *
-
-L<Opcode> has been upgraded from version 1.23 to 1.24 to reflect the removal of
-the boolkeys opcode.
-
-=item *
-
-L<Socket> has been upgraded from version 2.004 to 2.006.
-C<unpack_sockaddr_in()> and C<unpack_sockaddr_in6()> now return just the IP
-address in scalar context, and C<inet_ntop()> now guards against incorrect
-length scalars being passed in.
-
-=item *
-
-L<Storable> has been upgraded from version 2.38 to 2.39.  This contains Various
-bugfixes, including compatibility fixes for older versions of Perl and vstring
-handling.
-
-=item *
-
-L<threads::shared> has been upgraded from version 1.40 to 1.41.  This adds the
-option to warn about or ignore attempts to clone structures that can't be
-cloned, as opposed to just unconditionally dying in that case.
-
-=item *
-
-L<XSLoader> has been upgraded from version 0.15 to 0.16.
+L<GDBM_File> has been upgraded from version 1.14 to 1.15. The undocumented
+optional fifth parameter to C<TIEHASH> has been removed. This was intended
+to provide control of the callback used by C<gdbm*> functions in case of
+fatal errors (such as filesystem problems), but did not work (and could
+never have worked). No code on CPAN even attempted to use it. The callback
+is now always the previous default, C<croak>. Problems on some platforms with
+how the C<C> C<croak> function is called have also been resolved.
 
 =back
 
@@ -295,13 +223,16 @@ XXX Changes which significantly change existing files in F<pod/> go here.
 However, any changes to F<pod/perldiag.pod> should go in the L</Diagnostics>
 section.
 
-=head3 L<XXX>
+=head3 L<perlapi/Character classes>
 
 =over 4
 
 =item *
 
-XXX Description of the change here
+There are quite a few macros callable from XS modules that classify
+characters into things like alphabetic, punctuation, etc.  More of these
+are now documented, including ones which work on characters whose code
+points are outside the Latin-1 range.
 
 =back
 
@@ -383,8 +314,7 @@ L</Platform Support> section, instead.
 
 =item *
 
-F<Configure> will now correctly detect C<isblank()> when compiling with a C++
-compiler.
+XXX
 
 =back
 
@@ -432,12 +362,9 @@ XXX
 
 =over 4
 
-=item VM/ESA
+=item BeOS
 
-Support for VM/ESA has been removed. The port was tested on 2.3.0, which
-IBM ended service on in March 2002. 2.4.0 ended service in June 2003, and
-was superseded by Z/VM. The current version of Z/VM is V6.2.0, and scheduled
-for end of service on 2015/04/30.
+Support for BeOS has been removed.
 
 =back
 
@@ -450,24 +377,9 @@ L</Modules and Pragmata> section.
 
 =over 4
 
-=item Win32
-
-Fixed a problem where perl could crash while cleaning up threads (including the
-main thread) in threaded debugging builds on Win32 and possibly other platforms
-[perl #114496].
-
-=item Solaris
-
-In Configure, avoid running sed commands with flags not supported on Solaris.
-
-=item Darwin
-
-Stop hardcoding an alignment on 8 byte boundaries to fix builds using
--Dusemorebits.
-
-=item VMS
+=item XXX-some-platform
 
-Fix linking on builds configured with -Dusemymalloc=y.
+XXX
 
 =back
 
@@ -483,13 +395,55 @@ well.
 
 =item *
 
-The APIs for accessing lexical pads have changed considerably.
+SvUPGRADE() is no longer an expression. Originally this macro (and its
+underlying function, sv_upgrade()) were documented as boolean, although
+in reality they always croaked on error and never returned false. In 2005
+the documentation was updated to specify a void return value, but
+SvUPGRADE() was left always returning 1 for backwards compatibility. This
+has now been removed, and SvUPGRADE() is now a statement with no return
+value.
+
+So this is now a syntax error:
+
+    if (!SvUPGRADE(sv)) { croak(...); }
+
+If you have code like that, simply replace it with
+
+    SvUPGRADE(sv);
+
+or to to avoid compiler warnings with older perls, possibly
+
+    (void)SvUPGRADE(sv);
+
+=item *
+
+Perl has a new copy-on-write mechanism that allows any SvPOK scalar to be
+upgraded to a copy-on-write scalar.  A reference count on the string buffer
+is stored in the string buffer itself.
+
+This breaks a few XS modules by allowing copy-on-write scalars to go
+through code paths that never encountered them before.
+
+This behaviour can still be disabled by running F<Configure> with
+B<-Accflags=-DPERL_NO_COW>.  This option will probably be removed in Perl
+5.20.
+
+=item *
+
+Copy-on-write no longer uses the SvFAKE and SvREADONLY flags.  Hence,
+SvREADONLY indicates a true read-only SV.
 
-C<PADLIST>s are now longer C<AV>s, but their own type instead. C<PADLIST>s now
-contain a C<PAD> and a C<PADNAMELIST> of C<PADNAME>s, rather than C<AV>s for the
-pad and the list of pad names.  C<PAD>s, C<PADNAMELIST>s, and C<PADNAME>s are to
-be accessed as such though the newly added pad API instead of the plain C<AV>
-and C<SV> APIs.  See L<perlapi> for details.
+Use the SvIsCOW macro (as before) to identify a copy-on-write scalar.
+
+=item *
+
+C<PL_sawampersand> is now a constant.  The switch this variable provided
+(to enable/disable the pre-match copy depending on whether C<$&> had been
+seen) has been removed and replaced with copy-on-write, eliminating a few
+bugs.
+
+The previous behaviour can still be enabled by running F<Configure> with
+B<-Accflags=-DPERL_SAWAMPERSAND>.
 
 =back
 
@@ -498,42 +452,84 @@ and C<SV> APIs.  See L<perlapi> for details.
 XXX Important bug fixes in the core language are summarized here.  Bug fixes in
 files in F<ext/> and F<lib/> are best summarized in L</Modules and Pragmata>.
 
+[ List each fix as a =item entry ]
+
 =over 4
 
 =item *
 
-Restore ‘Can’t localize through ref’ to lvalue subs.  This error had disappeared
-under certain conditions in version 5.16.0 and has now been restored.
+C<sort {undef} ...> under fatal warnings no longer crashes.  It started
+crashing in Perl 5.16.
+
+=item *
+
+Stashes blessed into each other
+(C<bless \%Foo::, 'Bar'; bless \%Bar::, 'Foo'>) no longer result in double
+frees.  This bug started happening in Perl 5.16.
+
+=item *
+
+Numerous memory leaks have been fixed, mostly involving fatal warnings and
+syntax errors.
+
+=item *
+
+Lexical constants (C<my sub answer () { 42 }>) no longer cause double
+frees.
+
+=item *
+
+Constant subroutine redefinition warns by default, but lexical constants
+were accidentally exempt from default warnings.  This has been corrected.
 
 =item *
 
-The parsing of heredocs has been improved significantly, fixing several parsing
-bugs and correcting wrong subsequent line numbers under certain conditions.
+Some failed regular expression matches such as C<'f' =~ /../g> were not
+resetting C<pos>.  Also, "match-once" patterns (C<m?...?g>) failed to reset
+it, too, when invoked a second time [perl #23180].
 
 =item *
 
-Reset the utf8 position cache when accessing magical variables to avoid the
-string buffer and the utf8 position cache to get out of sync.
+Accessing C<$&> after a pattern match now works if it had not been seen
+before the match.  I.e., this applies to C<${'&'}> (under C<no strict>) and
+C<eval '$&'>.  The same applies to C<$'> and C<$`> [perl #4289].
 
 =item *
 
-Various cases of get magic being called twice for magical utf8 strings have been
-fixed.
+Several bugs involving C<local *ISA> and C<local *Foo::> causing stale
+MRO caches have been fixed.  
 
 =item *
 
-This code (when not in the presence of C<$&> etc)
+Defining a subroutine when its typeglob has been aliased no longer results
+in stale method caches.  This bug was introduced in Perl 5.10.
 
-    $_ = 'x' x 1_000_000;
-    1 while /(.)/;
+=item *
+
+Localising a typeglob containing a subroutine when the typeglob's package
+has been deleted from its parent stash no longer produces an error.  This
+bug was introduced in Perl 5.14.
+
+=item *
 
-used to skip the buffer copy for performance reasons, but suffered from C<$1>
-etc changing if the original string changed.  That's now been fixed.
+Under some circumstances, C<local *method=...> would fail to reset method
+caches upon scope exit.
 
 =item *
 
-Perl doesn't use PerlIO anymore to report out of memory messages, as PerlIO
-might attempt to allocate more memory.
+C</[.foo.]/> is no longer an error, but produces a warning (as before) and
+is treated as C</[.fo]/> [perl #115818].
+
+=item *
+
+C<goto $tied_var> now calls FETCH before deciding what type of goto
+(subroutine or label) this is.
+
+=item *
+
+Renaming packages through glob assignment
+(C<*Foo:: = *Bar::; *Bar:: = *Baz::>) in combination with C<m?...?> and
+C<reset> no longer makes threaded builds crash.
 
 =back
 
@@ -549,10 +545,7 @@ platform specific bugs also go here.
 
 =item *
 
-Changes in the lexical pad API break several CPAN modules.
-
-To avoid having to patch those modules again later if we change pads from AVs
-into their own types, APIs for accessing the contents of pads have been added.
+XXX
 
 =back
 
@@ -565,7 +558,7 @@ here.
 
 XXX Generate this with:
 
-  perl Porting/acknowledgements.pl v5.17.3..HEAD
+  perl Porting/acknowledgements.pl v5.17.6..HEAD
 
 =head1 Reporting Bugs