This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Filter::Util::Call to CPAN version 1.51
[perl5.git] / pod / perldelta.pod
index f246ffb..659a470 100644 (file)
@@ -27,6 +27,12 @@ here, but most should go in the L</Performance Enhancements> section.
 
 [ List each enhancement as a =head2 entry ]
 
+=head2 faster array and hash lookups
+
+Array and hash lookups (especially nested ones) that use only constants
+or simple variables as keys, are now considerably faster. See
+L</Internal Changes> for more details.
+
 =head2 C<fileno> now works on directory handles
 
 When the relevant support is available in the operating system, the
@@ -74,6 +80,12 @@ The L<encoding> pragma's effect is now limited to lexical scope.  This
 pragma is deprecated, but in the meantime, it could adversely affect
 unrelated modules that are included in the same program.
 
+=head2 List slices returning empty lists
+
+List slices return an empty list now only if the original list was empty
+(or if there are no indices).  Formerly, a list slice would return an empty
+list if all indices fell outside the original list.  [perl #114498]
+
 =head1 Deprecations
 
 XXX Any deprecated features, syntax, modules etc. should be listed here.
@@ -130,6 +142,13 @@ Win32 Perl uses 8 KB less of per-process memory than before for every perl
 process of this version. This data is now memory mapped from disk and shared
 between perl processes from the same perl binary.
 
+=item *
+
+If method and class names are known at compile time, hashes are precomputed
+to speed up run-time method lookup.  Also, compound method names like
+C<SUPER::new> are parsed at compile time, to save having to parse them at
+run time.
+
 =back
 
 =head1 Modules and Pragmata
@@ -176,8 +195,58 @@ L<B::Deparse> has been upgraded from version 1.30 to 1.31.
 BEGIN blocks at the end of the enclosing scope are now deparsed in the
 right place.  [perl #77452]
 
+BEGIN blocks were sometimes deparsed as __ANON__, but are now always called
+BEGIN.
+
 Lexical subroutines are now fully deparsed.  [perl #116553]
 
+Deparsing of C<$lexical =~ //> was accidentally broken in 1.30 (perl
+5.21.6), omitting the C<$lexical =~>, but has now been fixed.
+
+C<Anything =~ y///r> with C</r> no longer omits the left-hand operand.
+
+The op trees that make up regexp code blocks are now deparsed for real.
+Formerly, the original string that made up the regular expression was used.
+That caused problems with C<qr/(?{<<heredoc})/> and multiline code blocks,
+which were deparsed incorrectly.  [perl #123217] [perl #115256]
+
+C<$;> at the end of a statement no longer loses its semicolon.
+[perl #123357]
+
+Some cases of subroutine declarations stored in the stash in shorthand form
+were being omitted.
+
+Non-ASCII characters are now consistently escaped in strings, instead of
+some of the time.  (There are still outstanding problems with regular
+expressions and identifiers that have not been fixed.)
+
+When prototype sub calls are deparsed with C<&> (e.g., under the B<-P>
+option), C<scalar> is now added where appropriate, to force the scalar
+context implied by the prototype.
+
+C<require(foo())>, C<do(foo())>, C<goto(foo())> and similar constructs with
+loop controls are now deparsed correctly.  The outer parentheses are not
+optional.
+
+Whitespace is no longer escaped in regular expressions, because it was
+getting erroneously escaped within C<(?x:...)> sections.
+
+C<sub foo { foo() }> is now deparsed with those mandatory parentheses.
+
+C</@array/> is now deparsed as a regular expression, and not just
+C<@array>.
+
+C</@{-}/>, C</@{+}/> and C<$#{1}> are now deparsed with the braces, which
+are mandatory in these cases.
+
+In deparsing feature bundles, B::Deparse was emitting C<no feature;> first
+instead of C<no feature ':all';>.  This has been fixed.
+
+C<chdir FH> is now deparsed without quotation marks.
+
+C<\my @a> is now deparsed without parentheses.  (Parenthese would flatten
+the array.)
+
 =item *
 
 L<ExtUtils::ParseXS> has been upgraded from version 3.26 to 3.27.
@@ -187,6 +256,9 @@ Only declare C<file> unused if we actually define it.
 Improve generated C<RETVAL> code generation to avoid repeated
 references to C<ST(0)>.  [perl #123278]
 
+Broaden and document the C</OBJ$/> to C</REF$/> typemap optimization
+for the C<DESTROY> method.  [perl #123418]
+
 =item *
 
 The PathTools module collection has been upgraded from 3.52 to 3.53.
@@ -413,6 +485,31 @@ true.  Previously, this was effectively the case already, but any support
 for two different internal representations of pad names has now been
 removed.
 
+=item *
+
+The C<OP_SIBLING> and C<OP_HAS_SIBLING> macros added in an earlier 5.21.x
+release have been renamed C<OpSIBLING> and C<OpHAS_SIBLING>, following the
+existing convention.
+
+=item *
+
+A new op class, C<UNOP_AUX>, has been added. This is a subclass of
+C<UNOP> with an C<op_aux> field added, which points to an array of unions
+of C<UV>, C<SV*> etc. It is intended for where an op needs to store more data
+than a simple C<op_sv> or whatever. Currently the only op of this type is
+C<OP_MULTIDEREF> (see below).
+
+=item *
+
+A new op has been added, C<OP_MULTIDEREF>, which performs one or more
+nested array and hash lookups where the key is a constant or simple
+variable. For example the expression C<$a[0]{$k}[$i]>, which previously
+involved ten C<rv2Xv>, C<Xelem>, C<gvsv> and C<const> ops is now performed
+by a single C<multideref> op. It can also handle C<local>, C<exists> and
+C<delete>. A non-simple index expression, such as C<[$i+1]> is still done
+using C<aelem/helem>, and single-level array lookup with a small constant
+index is still done using C<aelemfast>.
+
 =back
 
 =head1 Selected Bug Fixes
@@ -429,7 +526,7 @@ files in F<ext/> and F<lib/> are best summarized in L</Modules and Pragmata>.
 On Win32, restoring in a child pseudo-process a variable that was
 C<local()>ed in a parent pseudo-process before the C<fork> happened caused
 memory corruption and a crash in the child pseudo-process (and therefore OS
-process). 
+process).  [perl #40565]
 
 =item *
 
@@ -465,6 +562,22 @@ C<for(scalar($#foo)) { ... }> can modify C<$#foo> through C<$_>.
 C<qr/@array(?{block})/> no longer dies with "Bizarre copy of ARRAY".
 [#123344]
 
+=item *
+
+C<eval '$variable'> in nested named subroutines would sometimes look up a
+global variable even with a lexical variable in scope.
+
+In perl 5.20.0, C<sort CORE::fake> where 'fake' is anything other than a
+keyword started chopping of the last 6 characters and treating the result
+as a sort sub name.  The previous behaviour of treating "CORE::fake" as a
+sort sub name has been restored.  [perl #123410]
+
+=item *
+
+Outside of C<use utf8>, a single-character Latin-1 lexical variable is
+disallowed.  The error message for it, "Can't use global $foo...", was
+giving garbage instead of the variable name.
+
 =back
 
 =head1 Known Problems