This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta: add recent regex API changes
[perl5.git] / pod / perldelta.pod
index 325e95a..0e350af 100644 (file)
@@ -2,19 +2,18 @@
 
 =head1 NAME
 
-[ this is a template for a new perldelta file. Any text flagged as
-XXX needs to be processed before release. ]
+[ 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.3
+perldelta - what is new for perl v5.17.4
 
 =head1 DESCRIPTION
 
-This document describes differences between the 5.17.2 release and
-the 5.17.3 release.
+This document describes differences between the 5.17.3 release and the 5.17.4
+release.
 
-If you are upgrading from an earlier release such as 5.17.1, first read
-L<perl5172delta>, which describes differences between 5.17.1 and
-5.17.2.
+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.
 
 =head1 Notice
 
@@ -22,18 +21,36 @@ XXX Any important notices here
 
 =head1 Core Enhancements
 
-XXX New core language features go here. Summarise user-visible core language
-enhancements. Particularly prominent performance optimisations could go
+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.
 
 [ List each enhancement as a =head2 entry ]
 
-=head2 Computed Labels
+=head2 Latest Unicode 6.2 beta is included
 
-The loop controls C<next>, C<last> and C<redo>, and the special C<dump>
-operator, now allow arbitrary expressions to be used to compute labels at
-run time.  Previously, any argument that was not a constant was treated as
-the empty string.
+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
 
 =head1 Security
 
@@ -45,41 +62,26 @@ L</Selected Bug Fixes> section.
 
 =head1 Incompatible Changes
 
-[ List each incompatible change as a =head2 entry ]
-
-=head2 C<$ENV{foo} = undef> deletes value from environ, like C<delete $ENV{foo}>
-
-This facilitates use of C<local()> with C<%ENV> entries.  In previous
-versions of Perl, C<undef> was converted to the empty string.
+XXX For a release on a stable branch, this section aspires to be:
 
-=head2 Defined values stored in environment are forced to byte strings
+    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.
 
-A value stored in an environment variable has always been stringified.  In
-this release, it is converted to be only a byte string.  First, it is forced
-to be a only a string.  Then if the string is utf8 and the equivalent of
-C<utf8::downgrade> works, that result is used; otherwise, the equivalent of
-C<utf8::encode> is used, and a warning is issued about wide characters
-(L</Diagnostics>).
-
-=head2 C<given> now aliases the global $_
-
-Instead of assigning to an implicit lexical $_, C<given> now makes the
-global $_ an alias for its argument, just like C<foreach>.  However, it
-still uses lexical $_ if there is lexical $_ in scope (again, just like
-C<foreach>).
+[ List each incompatible change as a =head2 entry ]
 
 =head1 Deprecations
 
-XXX Any deprecated features, syntax, modules etc. should be listed here.
-In particular, deprecated modules should be listed here even if they are
-listed as an updated module in the L</Modules and Pragmata> section.
+XXX Any deprecated features, syntax, modules etc. should be listed here.  In
+particular, deprecated modules should be listed here even if they are listed as
+an updated module in the L</Modules and Pragmata> section.
 
 [ List each deprecation as a =head2 entry ]
 
 =head1 Performance Enhancements
 
-XXX Changes which enhance performance without changing behaviour go here. There
-may well be none in a stable release.
+XXX Changes which enhance performance without changing behaviour go here.
+There may well be none in a stable release.
 
 [ List each enhancement as a =item entry ]
 
@@ -87,7 +89,62 @@ may well be none in a stable release.
 
 =item *
 
-XXX
+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.
+
+=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.
+
+=item *
+
+Apply the optimisation of hashes in boolean context, such as in C<if> or C<and>,
+to constructs in non-void context.
+
+=item *
+
+Extend the optimisation of hashes in boolean context to C<scalar(%hash)>,
+C<%hash ? ... : ...>, and C<sub { %hash || ... | }>.
+
+=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 /(.)/;
+
+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)/
+
+whereas previously it was like
+
+   /^(.*)(x)(.*)$/
+
+and
+
+   $&; $'; /x/
+
+is now roughly equivalent to
+
+   /(x)(.*)$/
+
+etc.
 
 =back
 
@@ -119,21 +176,93 @@ XXX
 
 =item *
 
-L<B> has been upgraded from version 1.36 to version 1.37. All C<CVf_*> and
-C<GVf_*> and more SV-related flag values are now provided as constants in
-the C<B::> namespace and available for export. The default export list has
-not changed.
+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<B::Deparse> has been upgraded from version 1.15 to 1.16.  It now deparses
-loop controls with the correct precedence.
+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<Storable> has been upgraded from version 2.37 to 2.38.  It can now freeze
-and thaw vstrings correctly.  This causes a slight incompatible change in
-the storage format, so the format version has increased to 2.9.
+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.
 
 =back
 
@@ -166,15 +295,13 @@ 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<perlfunc>, L<perlop>
+=head3 L<XXX>
 
 =over 4
 
 =item *
 
-Loop control verbs (C<dump>, C<goto>, C<next>, C<last> and C<redo>) have
-always had the same precedence as assignment operators, but this was never
-documented until now.
+XXX Description of the change here
 
 =back
 
@@ -184,29 +311,13 @@ The following additions or changes have been made to diagnostic output,
 including warnings and fatal error messages.  For the complete list of
 diagnostic messages, see L<perldiag>.
 
-XXX New or changed warnings emitted by the core's C<C> code go here. Also
+XXX New or changed warnings emitted by the core's C<C> code go here.  Also
 include any changes in L<perldiag> that reconcile it to the C<C> code.
 
-[ Within each section, list entries as a =item entry that links to perldiag,
-  e.g.
-
-  =item *
-
-  L<Invalid version object|perldiag/"Invalid version object">
-]
-
 =head2 New Diagnostics
 
-XXX Newly added diagnostic messages go here
-
-=over 4
-
-=item *
-
-Attempts to put wide characters into environment variables via %ENV provoke
-the warning "Wide character in setenv".
-
-=back
+XXX Newly added diagnostic messages go under here, separated into New Errors
+and New Warnings
 
 =head3 New Errors
 
@@ -242,8 +353,8 @@ XXX Describe change here
 
 =head1 Utility Changes
 
-XXX Changes to installed programs such as F<perlbug> and F<xsubpp> go
-here. Most of these are built within the directories F<utils> and F<x2p>.
+XXX Changes to installed programs such as F<perlbug> and F<xsubpp> go here.
+Most of these are built within the directories F<utils> and F<x2p>.
 
 [ List utility changes as a =head3 entry for each utility and =item
 entries for each change
@@ -272,7 +383,8 @@ L</Platform Support> section, instead.
 
 =item *
 
-XXX
+F<Configure> will now correctly detect C<isblank()> when compiling with a C++
+compiler.
 
 =back
 
@@ -281,7 +393,7 @@ XXX
 XXX Any significant changes to the testing of a freshly built perl should be
 listed here.  Changes which create B<new> files in F<t/> go here as do any
 large changes to the testing harness (e.g. when parallel testing was added).
-Changes to existing files in F<t/> aren't worth summarising, although the bugs
+Changes to existing files in F<t/> aren't worth summarizing, although the bugs
 that they represent may be covered elsewhere.
 
 [ List each test improvement as a =item entry ]
@@ -304,7 +416,7 @@ changes as paragraphs below it. ]
 =head2 New Platforms
 
 XXX List any platforms that this version of perl compiles on, that previous
-versions did not. These will either be enabled by new files in the F<hints/>
+versions did not.  These will either be enabled by new files in the F<hints/>
 directories, or new subdirectories and F<README> files at the top level of the
 source tree.
 
@@ -318,36 +430,52 @@ XXX
 
 =head2 Discontinued Platforms
 
-XXX List any platforms that this version of perl no longer compiles on.
-
 =over 4
 
-=item XXX-some-platform
+=item VM/ESA
 
-XXX
+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.
 
 =back
 
 =head2 Platform-Specific Notes
 
-XXX List any changes for specific platforms. This could include configuration
+XXX List any changes for specific platforms.  This could include configuration
 and compilation changes or changes in portability/compatibility.  However,
 changes within modules for platforms should generally be listed in the
 L</Modules and Pragmata> section.
 
 =over 4
 
-=item XXX-some-platform
+=item Win32
 
-XXX
+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
+
+Fix linking on builds configured with -Dusemymalloc=y.
 
 =back
 
 =head1 Internal Changes
 
-XXX Changes which affect the interface available to C<XS> code go here.
-Other significant internal changes for future core maintainers should
-be noted as well.
+XXX Changes which affect the interface available to C<XS> code go here.  Other
+significant internal changes for future core maintainers should be noted as
+well.
 
 [ List each change as a =item entry ]
 
@@ -355,72 +483,79 @@ be noted as well.
 
 =item *
 
-XXX
+The APIs for accessing lexical pads have changed considerably.
 
-=back
+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.
 
-=head1 Selected Bug Fixes
+=item *
 
-XXX Important bug fixes in the core language are summarised here.
-Bug fixes in files in F<ext/> and F<lib/> are best summarised in
-L</Modules and Pragmata>.
+In the regex API, the numbered capture callbacks are passed an index
+indicating what match variable is being accessed. There are special
+index values for the C<$`, $&, $&> variables. Previously the same three
+values were used to retrieve C<${^PREMATCH}, ${^MATCH}, ${^POSTMATCH}>
+too, but these have now been assigned three separate values. See
+L<perlreapi/Numbered capture callbacks>.
 
-[ List each fix as a =item entry ]
+=item *
 
-=over 4
+C<PL_sawampersand> was previously a boolean indicating that any of
+C<$`, $&, $&> had been seen; it now contains three one-bit flags
+indicating the presence of each of the variables individually.
 
-=item *
+=back
 
-C<\w> now matches the code points U+200C (ZERO WIDTH NON-JOINER) and
-U+200D (ZERO WIDTH JOINER).  C<\W> no longer matches these.  This change
-is because Unicode corrected their definition of what C<\w> should match.
+=head1 Selected Bug Fixes
 
-=item *
+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>.
 
-C<dump LABEL> no longer leaks its label.
+=over 4
 
 =item *
 
-Constant folding no longer changes the behaviour of functions like C<stat>
-and C<truncate> that can take either filenames or handles.
-C<stat 1 ? foo : bar> nows treats its argument as a file name (since it is
-an arbitrary expression), rather than the handle "foo".
+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.
 
 =item *
 
-C<truncate FOO, $len> no longer falls back to treating "FOO" as a file name
-if the filehandle has been deleted.  This was broken in Perl 5.16.0.
+The parsing of heredocs has been improved significantly, fixing several parsing
+bugs and correcting wrong subsequent line numbers under certain conditions.
 
 =item *
 
-Subroutine redefinitions after sub-to-glob and glob-to-glob assignments no
-longer cause double frees or panic messages.
+Reset the utf8 position cache when accessing magical variables to avoid the
+string buffer and the utf8 position cache to get out of sync.
 
 =item *
 
-C<s///> now turns vstrings into plain strings when performing a
-substitution, even if the resulting string is the same (C<s/a/a/>).
+Various cases of get magic being called twice for magical utf8 strings have been
+fixed.
 
 =item *
 
-Prototype mismatch warnings no longer erroneously treat constant subs as
-having no prototype when they actually have "".
+This code (when not in the presence of C<$&> etc)
 
-=item *
+    $_ = 'x' x 1_000_000;
+    1 while /(.)/;
 
-Constant subroutines and forward declarations no longer prevent prototype
-mismatch warnings from omitting the sub name.
+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.
 
 =item *
 
-C<undef> on a subroutine now clears call checkers.
+Perl doesn't use PerlIO anymore to report out of memory messages, as PerlIO
+might attempt to allocate more memory.
 
 =back
 
 =head1 Known Problems
 
-XXX Descriptions of platform agnostic bugs we know we can't fix go here. Any
-tests that had to be C<TODO>ed for the release would be noted here. Unfixed
+XXX Descriptions of platform agnostic bugs we know we can't fix go here.  Any
+tests that had to be C<TODO>ed for the release would be noted here.  Unfixed
 platform specific bugs also go here.
 
 [ List each fix as a =item entry ]
@@ -429,7 +564,10 @@ platform specific bugs also go here.
 
 =item *
 
-XXX
+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.
 
 =back
 
@@ -442,36 +580,34 @@ here.
 
 XXX Generate this with:
 
-  perl Porting/acknowledgements.pl v5.17.2..HEAD
+  perl Porting/acknowledgements.pl v5.17.3..HEAD
 
 =head1 Reporting Bugs
 
-If you find what you think is a bug, you might check the articles
-recently posted to the comp.lang.perl.misc newsgroup and the perl
-bug database at http://rt.perl.org/perlbug/ .  There may also be
-information at http://www.perl.org/ , the Perl Home Page.
+If you find what you think is a bug, you might check the articles recently
+posted to the comp.lang.perl.misc newsgroup and the perl bug database at
+http://rt.perl.org/perlbug/ .  There may also be information at
+http://www.perl.org/ , the Perl Home Page.
 
-If you believe you have an unreported bug, please run the L<perlbug>
-program included with your release.  Be sure to trim your bug down
-to a tiny but sufficient test case.  Your bug report, along with the
-output of C<perl -V>, will be sent off to perlbug@perl.org to be
-analysed by the Perl porting team.
+If you believe you have an unreported bug, please run the L<perlbug> program
+included with your release.  Be sure to trim your bug down to a tiny but
+sufficient test case.  Your bug report, along with the output of C<perl -V>,
+will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
 
 If the bug you are reporting has security implications, which make it
-inappropriate to send to a publicly archived mailing list, then please send
-it to perl5-security-report@perl.org. This points to a closed subscription
-unarchived mailing list, which includes
-all the core committers, who will be able
-to help assess the impact of issues, figure out a resolution, and help
+inappropriate to send to a publicly archived mailing list, then please send it
+to perl5-security-report@perl.org.  This points to a closed subscription
+unarchived mailing list, which includes all the core committers, who will be
+able to help assess the impact of issues, figure out a resolution, and help
 co-ordinate the release of patches to mitigate or fix the problem across all
-platforms on which Perl is supported. Please only use this address for
-security issues in the Perl core, not for modules independently
-distributed on CPAN.
+platforms on which Perl is supported.  Please only use this address for
+security issues in the Perl core, not for modules independently distributed on
+CPAN.
 
 =head1 SEE ALSO
 
-The F<Changes> file for an explanation of how to view exhaustive details
-on what changed.
+The F<Changes> file for an explanation of how to view exhaustive details on
+what changed.
 
 The F<INSTALL> file for how to build Perl.