This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta for 412989c
[perl5.git] / pod / perldelta.pod
index d031e4f..e4fbc83 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,63 @@ 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 Aliasing via reference
+
+Variables and subroutines can now be aliased by assigning to a reference:
+
+    \$c = \$d;
+    \&x = \&y;
+
+Or by using a backslash before a C<foreach> iterator variable, which is
+perhaps the most useful idiom this feature provides:
+
+    foreach \%hash (@array_of_hash_refs) { ... }
+
+This feature is experimental and must be enabled via C<use feature
+'refaliasing'>.  It will warn unless the C<experimental::refaliasing>
+warnings category is disabled.
+
+See L<perlref/Assigning to References>.
+
+=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>.
+
+=head2 Packing infinity or not-a-number into a character is now fatal.
+
+Before, when trying to pack infinity or not-a-number into a
+(signed) character, Perl would warn, and assumed you tried to
+pack C<< 0xFF >>; if you gave it as an argument to C<< chr >>,
+C<< U+FFFD >> was returned. 
+
+But now, all such actions (C<< pack >>, C<< chr >>, and C<< print '%c' >>)
+result in a fatal error.
 
 =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 ]
 
@@ -85,7 +128,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
 
@@ -98,7 +154,40 @@ There may well be none in a stable release.
 
 =item *
 
-XXX
+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 *
+
+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
+sometimes.  Now this optimisation happens
+almost all the time.
+
+=item *
+
+C<join> is now subject to constant folding.  Moreover, C<join> with a
+scalar or constant for the separator and a single-item list to join is
+simplified to a stringification.  The separator doesn't even get evaluated.
+
+=item *
+
+C<qq(@array)> is implemented using two ops: a stringify op and a join op.
+If the qq contains nothing but a single array, the stringification is
+optimised away.
+
+=item *
+
+C<our $var> and C<our($s,@a,%h)> in void context are no longer evaluated at
+run time.  Even a whole sequence of C<our $foo;> statements will simply be
+skipped over.  The same applies to C<state> variables.
 
 =back
 
@@ -128,76 +217,83 @@ XXX
 
 =item *
 
-L<XXX> has been upgraded from version A.xx to B.yy.
+L<attributes> has been upgraded from version 0.23 to 0.24.
 
-=item *
-
-L<B::Concise> has been upgraded from version 0.992 to 0.993.
+Avoid reading beyond the end of a buffer. [perl #122629]
 
 =item *
 
-L<CPAN::Meta::Requirements> has been upgraded from version 2.126 to 2.128.
+L<B::Concise> has been upgraded from version 0.993 to 0.994.
 
-=item *
+Null ops that are part of the execution chain are now given sequence
+numbers.
 
-L<ExtUtils::CBuilder> has been upgraded from version 0.280216 to 0.280219.
-[perl #122675].
+Private flags for nulled ops are now dumped with mnemonics as they would be
+for the non-nulled counterparts.
 
-=item *
+L<B::Deparse> has been upgraded from version 1.28 to 1.29.
 
-L<ExtUtils::Manifest> has been upgraded from version 1.65 to 1.66.
-[perl #122415].
+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<ExtUtils::ParseXS>:  Documentation has been added to
-F<ExtUtils-ParseXS/lib/perlxs.pod> concerning handling of locales when writing
-XS code.
+C<for($foo; !$bar; $baz) {...}> was deparsed without the C<!> (or C<not>).
+This has been fixed.
 
-=item *
+Core keywords that conflict with lexical subroutines are now deparsed with
+the C<CORE::> prefix.
 
-L<File::Find> has been upgraded from version 1.27 to 1.28.
+C<foreach state $x (...) {...}> now deparses correctly with C<state> and
+not C<my>.
 
-C<find()> and C<finddepth()> will now warn if passed inappropriate or
-misspelled options.
+C<our @array = split(...)> now deparses correctly with C<our> in those
+cases where the assignment is optimised away.
 
 =item *
 
-L<Getopt::Std> has been upgraded from version 1.10 to 1.11.
+L<DynaLoader> has been upgraded from version 1.26 to 1.27.
 
-=item *
-
-L<HTTP::Tiny> has been upgraded from version 0.047 to 0.048.
+Remove dl_nonlazy global if unused in Dynaloader. [perl #122926]
 
 =item *
 
-L<Module::CoreList> has been upgraded from version 5.021003 to 5.021004.
+L<Fcntl> has been upgraded from version 1.12 to 1.13.
+
+Add support for the Linux pipe buffer size fcntl() commands.
 
 =item *
 
-L<POSIX> has been upgraded from version 1.42 to 1.43.
+L<File::Find> has been upgraded from version 1.28 to 1.29.
 
-The C99 math functions and constants (for example acosh, round,
-M_E, M_PI) have been added.
+Slightly faster module loading time.
 
 =item *
 
-L<Pod::Perldoc> has been upgraded from version 3.23 to 3.24.
+L<Module::CoreList> has been upgraded from version 5.20140920 to 5.20141020.
+
+Updated to cover the latest releases of Perl.
 
 =item *
 
-Scalar-List-Utils has been upgraded from version 1.40 to 1.41.
+The PathTools module collection has been upgraded from version 3.50 to 3.51.
+
+Slightly faster module loading time.
 
 =item *
 
-L<constant> has been upgraded from version 1.31 to 1.32.
+L<POSIX> has been upgraded from version 1.44 to 1.45.
 
-It now accepts fully-qualified constant names, allowing constants to be
-defined in packages other than the caller.
+POSIX::tmpnam() now produces a deprecation warning.  [perl #122005]
 
 =item *
 
-L<threads> has been upgraded from version 1.95 to 1.96.
+L<XSLoader> has been upgraded from version 0.17 to 0.18.
+
+Allow XSLoader to load modules from a different namespace.
+[perl #122455]
 
 =back
 
@@ -236,12 +332,12 @@ section.
 
 =item *
 
-XXX Description of the change here
-
-=item *
-
-L<perlsyn>: An ambiguity in the documentation of the Ellipsis statement has
-been corrected. [perl #122661]
+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
 
@@ -265,55 +361,42 @@ and New Warnings
 
 =item *
 
-XXX L<message|perldiag/"message">
-
-=back
-
-=head3 New Warnings
-
-=over 4
+L<message|perldiag/"Cannot chr %f">
 
 =item *
 
-XXX L<message|perldiag/"message">
+L<message|perldiag/"Cannot compress %f in pack">
 
-=back
-
-=head2 Changes to Existing Diagnostics
-
-XXX Changes (i.e. rewording) of diagnostic messages go here
+=item *
 
-=over 4
+L<message|perldiag/"Cannot pack %f with '%c'">
 
 =item *
 
-XXX Describe change here
+L<message|perldiag/"Cannot printf %f with '%c'">
 
 =back
 
-=head2 Diagnostic Removals
+=head3 New Warnings
 
 =over 4
 
 =item *
 
-"Constant is not a FOO reference"
+XXX L<message|perldiag/"message">
 
-Compile-time checking of constant dereferencing (e.g.,
-C<< my_constant->() >>) has been removed, since it was not taking
-overloading into account.  [perl #69456] [perl #122607]
+=back
 
-=item *
+=head2 Changes to Existing Diagnostics
 
-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>.
+XXX Changes (i.e. rewording) of diagnostic messages go here
+
+=over 4
 
 =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
 
@@ -367,7 +450,10 @@ that they represent may be covered elsewhere.
 
 =item *
 
-XXX
+Some regular expression tests are written in such a way that they will
+run very slowly if certain optimizations break. These tests have been
+moved into new files, F<< t/re/speed.t >> and F<< t/re/speed_thr.t >>,
+and are run with a C<< watchdog() >>.
 
 =back
 
@@ -414,9 +500,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
 
@@ -430,7 +522,54 @@ well.
 
 =over 4
 
-XXX
+=item *
+
+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 *
+
+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<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<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 *
+
+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.
+
+=item *
+
+The macros SETsv and SETsvUN have been removed. They were no longer used
+in the core since commit 6f1401dc2a, and have not been found present on
+CPAN.
+
+=item *
+
+The C<< SvFAKE >> bit (unused on HVs) got informally reserved by
+David Mitchell for future work on vtables.
+
+=item *
+The C<sv_catpvn_flags> function accepts C<SV_CATBYTES> and C<SV_CATUTF8>
+flags, which specify whether the appended string is bytes or utf8,
+respectively.
 
 =back
 
@@ -445,105 +584,84 @@ 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.  [perl #69456]
+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 *
 
-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.
+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 *
 
-C<undef $reference> now frees the referent immediately, instead of hanging
-on to it until the next statement.  [perl #122556]
+The flip-flop operator (C<..> in scalar context) would return the same
+scalar each time, unless the containing subroutine was called recursively.
+Now it always returns a new scalar.  [perl #122829]
 
 =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.
+Some unterminated C<(?(...)...)> constructs in regular expressions would
+either crash or give erroneous error messages.  C</(?(1)/> is one such
+example.
 
 =item *
 
-Bareword lookup now tries to avoid vivifying packages if it turns out the
-bareword is not going to be a subroutine name.
+C<pack "w", $tied> no longer calls FETCH twice.
 
 =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. 
+List assignments like C<($x, $z) = (1, $y)> now work correctly if $x and $y
+have been aliased by C<foreach>.
 
 =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.
+Some patterns including code blocks with syntax errors, such as
+C</ (?{(^{})/>, would hang or fail assertions on debugging builds.  Now
+they produce errors.
 
 =item *
 
-Under some conditions a warning raised in compilation of regular
-expression patterns could be displayed multiple times.  This is now
-fixed.
+An assertion failure when parsing C<sort> with debugging enabled has been
+fixed.  [perl #122771]
 
 =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.
+C<*a = *b; @a = split //, $b[1]> could do a bad read and produce junk
+results.
 
 =item *
 
-Tainted constants evaluated at compile time no longer cause unrelated
-statements to become tainted.  [perl #122669]
+In C<() = @array = split>, the C<() => at the beginning no longer confuses
+the optimiser, making it assume a limit of 1.
 
 =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.
+Fatal warnings no longer prevent the output of syntax errors.
+[perl #122966]
 
 =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.
+Fixed a NaN double to long double conversion error on VMS. For quiet NaNs
+(and only on Itanium, not Alpha) negative infinity instead of NaN was
+produced. 
 
 =item *
 
-The parser no longer gets confused by C<\U=> within a double-quoted string.
-It used to roduce a syntax error, but now compiles it correctly.
-[perl #80368]
+Fixed the issue that caused C<< make distclean >> to leave files behind
+that shouldn't. [perl #122820]
 
 =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.
+AIX now sets the length in C<< getsockopt >> correctly. [perl #120835],
+[rt #91183], [rt #85570].
 
 =item *
 
-Under some conditions warning messages raised during regular expression
-pattern compilation were being output more than once.  This has now been
-fixed.
+During the pattern optimization phase, we no longer recurse into
+GOSUB/GOSTART when not SCF_DO_SUBSTR. This prevents the optimizer
+to run "forever" and exhaust all memory. [perl #122283]
 
 =back
 
@@ -583,7 +701,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