This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta for split-to-array
[perl5.git] / pod / perldelta.pod
index d815c96..5feaf4a 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.21.4
+perldelta - what is new for perl v5.21.5
 
 =head1 DESCRIPTION
 
-This document describes differences between the 5.21.3 release and the 5.21.4
+This document describes differences between the 5.21.4 release and the 5.21.5
 release.
 
-If you are upgrading from an earlier release such as 5.21.2, first read
-L<perl5213delta>, which describes differences between 5.21.2 and 5.21.3.
+If you are upgrading from an earlier release such as 5.21.3, first read
+L<perl5214delta>, which describes differences between 5.21.3 and 5.21.4.
 
 =head1 Notice
 
@@ -27,20 +27,35 @@ here, but most should go in the L</Performance Enhancements> section.
 
 [ List each enhancement as a =head2 entry ]
 
-=head2 Infinity and NaN (not-a-number) handling improved
+=head2 New double-diamond operator
 
-Floating point values are able to hold the special values infinity
-(also -infinity), and NaN (not-a-number).  Now we more robustly recognize
-and propagate the value in computations, and on output normalize them
-to C<Inf> and C<NaN>.
+C<<< <<>>> >>> is like C<< <> >> but uses three-argument C<open> to open
+each file in @ARGV.  So each element of @ARGV is an actual file name, and
+"|foo" won't be treated as a pipe open.
 
-See also the L<POSIX> enhancements.
+=head2 Perl now supports POSIX 2008 locale currency additions.
+
+On platforms that are able to handle POSIX.1-2008, the
+hash returned by
+L<C<POSIX::localeconv()>|perllocale/The localeconv function>
+includes the international currency fields added by that version of the
+POSIX standard.  These are
+C<int_n_cs_precedes>,
+C<int_n_sep_by_space>,
+C<int_n_sign_posn>,
+C<int_p_cs_precedes>,
+C<int_p_sep_by_space>,
+and
+C<int_p_sign_posn>.
 
 =head1 Security
 
-XXX Any security-related notices go here.  In particular, any security
-vulnerabilities closed should be noted here rather than in the
-L</Selected Bug Fixes> section.
+=head2 Perl is now compiled with -fstack-protector-strong if available
+
+Perl has been compiled with the anti-stack-smashing option
+C<-fstack-protector> since 5.10.1.  Now Perl uses the newer variant
+called C<-fstack-protector-strong>, if available.  (This was added
+already in 5.21.4.)
 
 [ List each security issue as a =head2 entry ]
 
@@ -54,23 +69,6 @@ XXX For a release on a stable branch, this section aspires to be:
 
 [ List each incompatible change as a =head2 entry ]
 
-=head2 Changes to the C<*> prototype
-
-The C<*> character in a subroutine's prototype used to allow barewords
-to take precedence over most, but not all subroutines.  It was never
-consistent and exhibited buggy behaviour.
-
-Now it has been changed, so subroutines always take precedence over
-barewords, which brings it into conformity with similarly prototyped
-built-in functions:
-
-    sub splat($) { ... }
-    sub foo { ... }
-    splat(foo); # now always splat(foo())
-    splat(bar); # still splat('bar') as before
-    close(foo); # close(foo())
-    close(bar); # close('bar')
-
 =head1 Deprecations
 
 XXX Any deprecated features, syntax, modules etc. should be listed here.
@@ -102,7 +100,20 @@ as an updated module in the L</Modules and Pragmata> section.
 
 =back
 
-[ List each other deprecation as a =head2 entry ]
+=head2 Use of multiple /x regexp modifiers
+
+It is now deprecated to say something like any of the following:
+
+    qr/foo/xx;
+    /(?xax:foo)/;
+    use re qw(/amxx);
+
+That is, now C<x> should only occur once in any string of contiguous
+regular expression pattern modifiers.  We do not believe there are any
+occurrences of this in all of CPAN.  This is in preparation for a future
+Perl release having C</xx> mean to allow white-space for readability in
+bracketed character classes (those enclosed in square brackets:
+C<[...]>).
 
 =head1 Performance Enhancements
 
@@ -115,20 +126,22 @@ There may well be none in a stable release.
 
 =item *
 
-Subroutines with an empty prototype and bodies containing just C<undef> are
-now eligible for inlining.
-L<[perl #122728]|https://rt.perl.org/Ticket/Display.html?id=122728>
+C<length> is up to 20% faster for non-magical/non-tied scalars containing a
+string if it is a non-utf8 string or if C<use bytes;> is in scope.
+
+=item *
+
+Non-magical/non-tied scalars that contain only a floating point value and are
+on most Perl builds with 64 bit integers now use 8-32 less bytes of memory
+depending on OS.
 
 =item *
 
-Subroutines in packages no longer need to carry typeglobs around with them.
-Declaring a subroutine will now put a simple sub reference in the stash if
-possible, saving memory.  The typeglobs still notionally exist, so
-accessing them will cause the subroutine reference to be upgraded to a
-typeglob.  This optimisation does not currently apply to XSUBs or exported
-subroutines, and method calls will undo it, since they cache things in
-typeglobs.
-L<[perl #120441]|https://rt.perl.org/Ticket/Display.html?id=120441>
+In C<@array = split>, the assigment can be optimised away with C<split>
+writing directly to the array.  This optimisation was happening only for
+package arrays other than @_ and only if the argument to split was an
+explicit constant or scalar other than $_.  Now this optimisation happens
+almost all the time.
 
 =back
 
@@ -158,145 +171,57 @@ XXX
 
 =item *
 
-L<Archive::Tar> has been upgraded from version 2.00 to 2.02.
-
-Tests can now be run in parallel.
-
-=item *
-
-L<Attribute::Handlers> has been upgraded from version 0.96 to 0.97.
-
-=item *
-
-L<attributes> has been upgraded from version 0.22 to 0.23.
-
-=item *
-
-L<B> has been upgraded from version 1.50 to 1.51.
-
-It provides a new C<B::safename> function, based on the existing
-C<< B::GV->SAFENAME >>, that converts "\cOPEN" to "^OPEN".
-
-=item *
-
-L<B::Concise> has been upgraded from version 0.992 to 0.993.
-
-=item *
-
-L<B::Deparse> has been upgraded from version 1.27 to 1.28.
-
-It now deparses C<our(I<LIST>)> and typed lexical (C<my Dog $spot>) correctly.
+L<attributes> has been upgraded from version 0.23 to 0.24.
 
-=item *
-
-L<bignum> has been upgraded from version 0.37 to 0.38.
+Avoid reading beyond the end of a buffer. [perl #122629]
 
 =item *
 
-L<constant> has been upgraded from version 1.31 to 1.32.
+L<B::Deparse> has been upgraded from version 1.28 to 1.29.
 
-It now accepts fully-qualified constant names, allowing constants to be defined
-in packages other than the caller.
+Parenthesised arrays in lists passed to C<\> are now correctly deparsed
+with parentheses (e.g., C<\(@a, (@b), @c)> now retains the parentheses
+around @b), this preserving the flattening behaviour of referenced
+parenthesised arrays.  Formerly, it only worked for one array: C<\(@a)>.
 
-=item *
+C<local our> is now deparsed correctly, with the C<our> included.
 
-L<CPAN::Meta::Requirements> has been upgraded from version 2.126 to 2.128.
-
-=item *
+C<for($foo; !$bar; $baz) {...}> was deparsed without the C<!> (or C<not>).
+This has been fixed.
 
-L<experimental> has been upgraded from version 0.008 to 0.010.
+Core keywords that conflict with lexical subroutines are now deparsed with
+the C<CORE::> prefix.
 
-=item *
+C<foreach state $x (...) {...}> now deparses correctly with C<state> and
+not C<my>.
 
-L<ExtUtils::CBuilder> has been upgraded from version 0.280217 to 0.280219.
-L<[perl #122675]|https://rt.perl.org/Ticket/Display.html?id=122675>
+C<our @array = split(...)> now deparses correctly with C<our> in those
+cases where the assignment is optimised away.
 
 =item *
 
-L<ExtUtils::Install> has been upgraded from version 1.68 to 2.04.
-
-=item *
+L<DynaLoader> has been upgraded from version 1.26 to 1.27.
 
-L<ExtUtils::Manifest> has been upgraded from version 1.65 to 1.68.
-L<[perl #122415]|https://rt.perl.org/Ticket/Display.html?id=122415>
+Remove dl_nonlazy global if unused in Dynaloader. [perl #122926]
 
 =item *
 
-L<File::Find> has been upgraded from version 1.27 to 1.28.
+L<Fcntl> has been upgraded from version 1.12 to 1.13.
 
-C<find()> and C<finddepth()> will now warn if passed inappropriate or
-misspelled options.
+Add support for the Linux pipe buffer size fcntl() commands.
 
 =item *
 
-L<Getopt::Std> has been upgraded from version 1.10 to 1.11.
-
-=item *
+L<Module::CoreList> has been upgraded from version 5.20140920 to 5.20141020.
 
-L<HTTP::Tiny> has been upgraded from version 0.047 to 0.049.
+Updated to cover the latest releases of Perl.
 
 =item *
 
-L<IO> has been upgraded from version 1.33 to 1.34.
-
-=item *
-
-L<IO::Socket::IP> has been upgraded from version 0.31 to 0.32.
-
-=item *
-
-L<Locale::Codes> has been upgraded from version 3.31 to 3.32.
-
-=item *
-
-L<Module::CoreList> has been upgraded from version 5.021003 to 5.20140915.
-
-=item *
-
-L<overload> has been upgraded from version 1.22 to 1.23.
-
-=item *
-
-PathTools has been upgraded from version 3.49 to 3.50.
-
-=item *
-
-L<Pod::Perldoc> has been upgraded from version 3.23 to 3.24.
-
-=item *
-
-L<POSIX> has been upgraded from version 1.42 to 1.43.
-
-The C99 math functions and constants (for example acosh, round, M_E, M_PI) have
-been added.
-
-=item *
-
-Scalar-List-Utils has been upgraded from version 1.39 to 1.41.
-
-=item *
-
-L<Term::ReadLine> has been upgraded from version 1.14 to 1.15.
-
-=item *
-
-L<Test::Harness> has been upgraded from version 3.32 to 3.33.
-
-=item *
-
-L<Test::Simple> has been upgraded from version 1.001003 to 1.001006.
-
-=item *
-
-L<threads> has been upgraded from version 1.95 to 1.96.
-
-=item *
+L<XSLoader> has been upgraded from version 0.17 to 0.18.
 
-L<Time::Piece> has been upgraded from version 1.27 to 1.29.
-
-=item *
-
-L<version> has been upgraded from version 0.9908 to 0.9909.
+Allow XSLoader to load modules from a different namespace.
+[perl #122455]
 
 =back
 
@@ -329,25 +254,18 @@ 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<perlsyn>
-
-=over 4
-
-=item *
-
-An ambiguity in the documentation of the Ellipsis statement has
-been corrected.
-L<[perl #122661]|https://rt.perl.org/Ticket/Display.html?id=122661>
-
-=back
-
-=head3 L<perlxs>
+=head3 L<XXX>
 
 =over 4
 
 =item *
 
-Added a discussion of locale issues in XS code.
+Clarifications have been added to L<perlrecharclass/Character Ranges>
+to the effect that Perl guarantees that C<[A-Z]>, C<[a-z]>, C<[0-9]> and
+any subranges thereof in regular expression bracketed character classes
+are guaranteed to match exactly what a naive English speaker would
+expect them to match, even on platforms (such as EBCDIC) where special
+handling is required to accomplish this.
 
 =back
 
@@ -393,35 +311,8 @@ XXX Changes (i.e. rewording) of diagnostic messages go here
 
 =item *
 
-XXX Describe change here
-
-=back
-
-=head2 Diagnostic Removals
-
-=over 4
-
-=item *
-
-"Constant is not a FOO reference"
-
-Compile-time checking of constant dereferencing (e.g.,
-C<< my_constant->() >>) has been removed, since it was not taking
-overloading into account.
-L<[perl #69456]|https://rt.perl.org/Ticket/Display.html?id=69456>
-L<[perl #122607]|https://rt.perl.org/Ticket/Display.html?id=122607>
-
-=item *
-
-The warning "Ambiguous use of -foo resolved as -&foo()" has been removed.
-There is actually no ambiguity here, and this impedes the use of negated
-constants; e.g., C<-Inf>.
-
-=item *
-
-The little-known C<my Class $var> syntax (see L<fields> and L<attributes>)
-could get confused in the scope of C<use utf8> if C<Class> were a constant
-whose value contained Latin-1 characters.
+'"my" variable &foo::bar can't be in a package' has been reworded to say
+'subroutine' instead of 'variable'.
 
 =back
 
@@ -522,9 +413,15 @@ L</Modules and Pragmata> section.
 
 =over 4
 
-=item XXX-some-platform
+=item EBCDIC
 
-XXX
+Special handling is required on EBCDIC platforms to get C<qr/[i-j]/> to
+match only C<"i"> and C<"j">, since there are 7 characters between the
+code points for C<"i"> and C<"j">.  This special handling had only been
+invoked when both ends of the range are literals.  Now it is also
+invoked if any of the C<\N{...}> forms for specifying a character by
+name or Unicode code point is used instead of a literal.  See
+L<perlrecharclass/Character Ranges>.
 
 =back
 
@@ -540,42 +437,36 @@ well.
 
 =item *
 
-C<save_re_context> no longer does anything and has been moved to
-F<mathoms.c>.
+SVs of type SVt_NV are now bodyless when a build configure and platform allow
+it, specifically C<sizeof(NV) <= sizeof(IV)>. The bodyless trick is the same one
+as for IVs since 5.9.2, but for NVs, unlike IVs, is not guarenteed on all
+platforms and build configurations.
 
 =item *
 
-C<cv_name> is a new API function that can be passed a CV or GV.  It returns
-an SV containing the name of the subroutine for use in diagnostics.
-L<[perl #116735]|https://rt.perl.org/Ticket/Display.html?id=116735>
-L<[perl #120441]|https://rt.perl.org/Ticket/Display.html?id=120441>
+The C<$DB::single>, C<$DB::signal> and C<$DB::trace> now have set and
+get magic that stores their values as IVs and those IVs are used when
+testing their values in C<pp_dbstate>.  This prevents perl from
+recursing infinity if an overloaded object is assigned to any of those
+variables. [perl #122445]
 
 =item *
 
-C<cv_set_call_checker_flags> is a new API function that works like
-C<cv_set_call_checker>, except that it allows the caller to specify whether
-the call checker requires a full GV for reporting the subroutine's name, or
-whether it could be passed a CV instead.  Whatever value is passed will be
-acceptable to C<cv_name>.  C<cv_set_call_checker> guarantees there will be
-a GV, but it may have to create one on the fly, which is inefficient.
-L<[perl #116735]|https://rt.perl.org/Ticket/Display.html?id=116735>
+C<Perl_tmps_grow> which is marked as public API but undocumented has been
+removed from public API. If you use C<EXTEND_MORTAL> macro in your XS code to
+preextend the mortal stack, you are unaffected by this change.
 
 =item *
 
-C<CvGV> (which is not part of the API) is now a more complex macro, which
-may call a function and reify a GV.  For those cases where is has been used
-as a boolean, C<CvHASGV> has been added, which will return true for CVs
-that notionally have GVs, but without reifying the GV.  C<CvGV> also
-returns a GV now for lexical subs.
-L<[perl #120441]|https://rt.perl.org/Ticket/Display.html?id=120441>
+C<cv_name>, which was introduced in 5.21.4, has been changed incompatibly.
+It now has a flags field that allows the caller to specify whether the name
+should be fully qualified.  See L<perlapi/cv_name>.
 
 =item *
 
-Added L<perlapi/sync_locale>.
-Changing the program's locale should be avoided by XS code.  Nevertheless,
-certain non-Perl libraries called from XS, such as C<Gtk> do so.  When this
-happens, Perl needs to be told that the locale has changed.  Use this function
-to do so, before returning to Perl.
+Internally Perl no longer uses the C<SVs_PADMY> flag.  C<SvPADMY()> now
+returns a true value for anything not marked PADTMP.  C<SVs_PADMY> is now
+defined as 0.
 
 =back
 
@@ -590,163 +481,52 @@ files in F<ext/> and F<lib/> are best summarized in L</Modules and Pragmata>.
 
 =item *
 
-XXX
-
-=item *
-
-Constant dereferencing now works correctly for typeglob constants.
-Previously the glob was stringified and its name looked up.  Now the glob
-itself is used.
-L<[perl #69456]|https://rt.perl.org/Ticket/Display.html?id=69456>
-
-=item *
-
-When parsing a funny character ($ @ % &) followed by braces, the parser no
-longer tries to guess whether it is a block or a hash constructor (causing
-a syntax error when it guesses the latter), since it can only be a block.
-
-=item *
-
-C<undef $reference> now frees the referent immediately, instead of hanging
-on to it until the next statement.
-L<[perl #122556]|https://rt.perl.org/Ticket/Display.html?id=122556>
-
-=item *
-
-Various cases where the name of a sub is used (autoload, overloading, error
-messages) used to crash for lexical subs, but have been fixed.
-
-=item *
-
-Bareword lookup now tries to avoid vivifying packages if it turns out the
-bareword is not going to be a subroutine name.
-
-=item *
-
-Compilation of anonymous constants (e.g., C<sub () { 3 }>) no longer
-deletes any subroutine named C<__ANON__> in the current package.  Not only
-was C<*__ANON__{CODE}> cleared, but there was a memory leak, too.  This bug
-goes back to perl 5.8.0.
-
-=item *
-
-Stub declarations like C<sub f;> and C<sub f ();> no longer wipe out
-constants of the same name declared by C<use constant>.  This bug was
-introduced in perl 5.10.0.
-
-=item *
-
-Under some conditions a warning raised in compilation of regular
-expression patterns could be displayed multiple times.  This is now
-fixed.
-
-=item *
-
-C<qr/[\N{named sequence}]/> now works properly in many instances.  Some
-names known to C<\N{...}> refer to a sequence of multiple characters,
-instead of the usual single character.  Bracketed character classes
-generally only match single characters, but now special handling has
-been added so that they can match named sequences, but not if the class
-is inverted or the sequence is specified as the beginning or end of a
-range.  In these cases, the only behavior change from before is a slight
-rewording of the fatal error message given when this class is part of a
-C<?[...])> construct.  When the C<[...]> stands alone, the same
-non-fatal warning as before is raised, and only the first character in
-the sequence is used, again just as before.
-
-=item *
-
-Tainted constants evaluated at compile time no longer cause unrelated
-statements to become tainted.
-L<[perl #122669]|https://rt.perl.org/Ticket/Display.html?id=122669>
-
-=item *
-
-C<open $$fh, ...>, which vivifies a handle with a name like "main::_GEN_0",
-was not giving the handle the right reference count, so a double free could
-happen.
-
-=item *
-
-When deciding that a bareword was a method name, the parser would get
-confused if an "our" sub with the same name existed, and look up the method
-in the package of the "our" sub, instead of the package of the invocant.
-
-=item *
-
-The parser no longer gets confused by C<\U=> within a double-quoted string.
-It used to produce a syntax error, but now compiles it correctly.
-L<[perl #80368]|https://rt.perl.org/Ticket/Display.html?id=80368>
-
-=item *
-
-It has always been the intention for the C<-B> and C<-T> file test
-operators to treat UTF-8 encoded files as text.
-(L<perlfunc|perlfunc/-X FILEHANDLE> has been updated to say this.)
-Previously, it was possible for some files to be considered UTF-8 that
-actually weren't valid UTF-8.  This is now fixed.  The operators now
-work on EBCDIC platforms as well.
-
-=item *
-
-Under some conditions warning messages raised during regular expression
-pattern compilation were being output more than once.  This has now been
-fixed.
-
-=item *
-
-A regression has been fixed that was introduced in v5.20.0 (fixed in
-v5.20.1 as well as here) in which a UTF-8 encoded regular expression
-pattern that contains a single ASCII lowercase letter does not match its
-uppercase counterpart.
-L<[perl #122655]|https://rt.perl.org/Ticket/Display.html?id=122655>
+Locking and unlocking values via L<Hash::Util> or C<Internals::SvREADONLY>
+no longer has any affect on values that are read-only to begin.  Unlocking
+such values could result in crashes, hangs or other erratic behaviour.
 
 =item *
 
-Constant folding could incorrectly suppress warnings if lexical warnings
-(C<use warnings> or C<no warnings>) were not in effect and C<$^W> were
-false at compile time and true at run time.
+The internal C<looks_like_number> function (which L<Scalar::Util> provides
+access to) began erroneously to return true for "-e1" in 5.21.4, affecting
+also C<-'-e1'>.  This has been fixed.
 
 =item *
 
-Loading UTF8 tables during a regular expression match could cause assertion
-failures under debugging builds if the previous match used the very same
-regular expression.
-L<[perl #122747]|https://rt.perl.org/Ticket/Display.html?id=122747>
+The flip-flop operator (C<..> in scalar context) would return the same
+scalar each time, unles the containing subroutine was called recursively.
+Now it always returns a new scalar.  [perl #122829]
 
 =item *
 
-Thread cloning used to work incorrectly for lexical subs, possibly causing
-crashes or double frees on exit.
+Some unterminated C<(?(...)...)> constructs in regular expressions would
+either crash or give erroneous error messages.  C</(?(1)/> is one such
+example.
 
 =item *
 
-Since perl 5.14.0, deleting C<$SomePackage::{__ANON__}> and then undefining
-an anonymous subroutine could corrupt things internally, resulting in
-L<Devel::Peek> crashing or L<B.pm|B> giving nonsensical data.  This has
-been fixed.
+C<pack "w", $tied> no longer calls FETCH twice.
 
 =item *
 
-C<(caller $n)[3]> now reports names of lexical subs, instead of treating
-them as "(unknown)".
+List assignments like C<($x, $z) = (1, $y)> now work correctly if $x and $y
+have been aliased by C<foreach>.
 
 =item *
 
-C<sort subname LIST> now supports lexical subs for the comparison routine.
+Some patterns including code blocks with syntax errors, such as
+C</ (?{(^{})/>, would hang or fail assertions on debugging builds.  Now
+they produce errors.
 
 =item *
 
-Aliasing (e.g., via C<*x = *y>) could confuse list assignments that mention
-the two names for the same variable on either side, causing wrong values to
-be assigned.  [perl #15667]
+An assertion failure when parsing C<sort> with debugging enabled has been
+fixed.  [perl #122771]
 
 =item *
 
-Long here-doc terminators could cause a bad read on short lines of input.
-This has been fixed.  It is doubtful that any crash could have occurred.
-This bug goes back to when here-docs were introduced in perl 3.000
-twenty-five years ago.
+C<*a = *b; @a = split //, $b[1]> could do a bad read and produce junk
+results.
 
 =back
 
@@ -786,7 +566,7 @@ here.
 
 XXX Generate this with:
 
-  perl Porting/acknowledgements.pl v5.21.3..HEAD
+  perl Porting/acknowledgements.pl v5.21.4..HEAD
 
 =head1 Reporting Bugs