This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
revise hash overhaul docs
[perl5.git] / pod / perldelta.pod
index 833fe45..9b41315 100644 (file)
@@ -44,11 +44,13 @@ experimental.
 =head2 Hash overhaul
 
 Changes to the implementation of hashes in perl 5.18.0 will be one of the most
-visible changes to the behavior of existing code.  For the most part, these
-changes will be visible as two distinct hash variables now providing their
-contents in a different order where it was previously identical.  When
-encountering these changes, the key to cleaning up from them is to accept that
-B<hashes are unordered collections> and to act accordingly.
+visible changes to the behavior of existing code.
+
+By default, two distinct hash variables with identical keys and values will now
+provide their contents in a different order where it was previously identical.
+
+When encountering these changes, the key to cleaning up from them is to accept
+that B<hashes are unordered collections> and to act accordingly.
 
 =head3 Hash randomization
 
@@ -76,35 +78,35 @@ support for several other hash functions.  This new function is expected to
 perform equivalently to the old one for shorter strings and is faster for
 hashing longer strings.
 
-=head3 PERL_HASH_SEED enviornment variable now takes a hex value
+=head3 PERL_HASH_SEED environment variable now takes a hex value
 
-PERL_HASH_SEED no longer accepts an integer as a parameter, instead the
-value is expected to be a binary string encoded in hex.  This is to make
-the infrastructure support hash seeds of arbitrary lengths which might
+C<PERL_HASH_SEED> no longer accepts an integer as a parameter;
+instead the value is expected to be a binary value encoded in a hex
+string, such as "0xf5867c55039dc724".  This is to make the
+infrastructure support hash seeds of arbitrary lengths, which might
 exceed that of an integer.  (SipHash uses a 16 byte seed).
 
 =head3 PERL_PERTURB_KEYS environment variable added
 
-PERL_PERTURB_KEYS environment variable allows one to control the level of
+The C<PERL_PERTURB_KEYS> environment variable allows one to control the level of
 randomization applied to C<keys> and friends.
 
-When PERL_PERTURB_KEYS is 0, perl will not randomize key order at all. The
+When C<PERL_PERTURB_KEYS> is 0, perl will not randomize the key order at all. The
 chance that C<keys> changes due to an insert will be the same as in previous
 perls, basically only when the bucket size is changed.
 
-When PERL_PERTURB_KEYS is 1, perl will randomize keys in a non repeatedable
+When C<PERL_PERTURB_KEYS> is 1, perl will randomize keys in a non-repeatable
 way. The chance that C<keys> changes due to an insert will be very high.  This
 is the most secure and default mode.
 
-When PERL_PERTURB_KEYS is 2, perl will randomize keys in a repeatedable way.
-Repititive runs of the same program should produce the same output every time.
-The chance that keys changes due to an insert will be very high.
+When C<PERL_PERTURB_KEYS> is 2, perl will randomize keys in a repeatable way.
+Repeated runs of the same program should produce the same output every time.
 
-PERL_HASH_SEED implies a non-default PERL_PERTURB_KEYS setting. Setting
-PERL_HASH_SEED=0 (exactly one 0) implies PERL_PERTURB_KEYS=0 (hash key
-randomization disabled), settng PERL_HASH_SEED to any other value, implies
-PERL_PERTURB_KEYS=2 (deterministic/repeatable hash key randomization).
-Specifying PERL_PERTURB_KEYS explicitly to a different level overrides this
+C<PERL_HASH_SEED> implies a non-default C<PERL_PERTURB_KEYS> setting. Setting
+C<PERL_HASH_SEED=0> (exactly one 0) implies C<PERL_PERTURB_KEYS=0> (hash key
+randomization disabled); settng C<PERL_HASH_SEED> to any other value implies
+C<PERL_PERTURB_KEYS=2> (deterministic and repeatable hash key randomization).
+Specifying C<PERL_PERTURB_KEYS> explicitly to a different level overrides this
 behavior.
 
 =head3 Hash::Util::hash_seed() now returns a string
@@ -116,7 +118,7 @@ which might exceed that of an integer.  (SipHash uses a 16 byte seed).
 =head3 Output of PERL_HASH_SEED_DEBUG has been changed
 
 The environment variable PERL_HASH_SEED_DEBUG now makes perl show both the
-hash function perl was built with AND the seed, in hex, in use for that
+hash function perl was built with, I<and> the seed, in hex, in use for that
 process. Code parsing this output, should it exist, must change to accommodate
 the new format.  Example of the new format:
 
@@ -125,10 +127,7 @@ the new format.  Example of the new format:
 
 =head2 Upgrade to Unicode 6.2
 
-Perl now supports the final version of Unicode 6.2.  Earlier releases in
-the 5.17 series supported Unicode 6.2 beta versions.  There were no
-substantive changes in the final Unicode 6.2 version from the most
-recent beta, included in Perl 5.17.4.  A list of changes from Unicode
+Perl now supports Unicode 6.2.  A list of changes from Unicode
 6.1 is at L<http://www.unicode.org/versions/Unicode6.2.0>.
 
 =head2 Character name aliases may now include non-Latin1-range characters
@@ -465,7 +464,7 @@ if lexical warnings were not already enabled:
     use warnings "void";
     $#; # void warning; no deprecation warning
 
-Now, the debugging, deprecated, glob, inplace and malloc warnings
+Now, the C<debugging>, C<deprecated>, C<glob>, C<inplace> and C<malloc> warnings
 categories are left on when turning on lexical warnings (unless they are
 turned off by C<no warnings>, of course).
 
@@ -473,8 +472,8 @@ This may cause deprecation warnings to occur in code that used to be free
 of warnings.
 
 Those are the only categories consisting only of default warnings.  Default
-warnings in other categories are still disabled by C<use warnings
-"category">, as we do not yet have the infrastructure for controlling
+warnings in other categories are still disabled by C<< use warnings "category" >>,
+as we do not yet have the infrastructure for controlling
 individual warnings.
 
 =head2 C<state sub> and C<our sub>
@@ -503,10 +502,10 @@ ignore the file and continue searching the directories in C<@INC>
 =head2 C<gv_fetchmeth_*> and SUPER
 
 The various C<gv_fetchmeth_*> XS functions used to treat a package whose
-named ended with ::SUPER specially.  A method lookup on the Foo::SUPER
-package would be treated as a SUPER method lookup on the Foo package.  This
-is no longer the case.  To do a SUPER lookup, pass the Foo stash and the
-GV_SUPER flag.
+named ended with C<::SUPER> specially.  A method lookup on the C<Foo::SUPER>
+package would be treated as a C<SUPER> method lookup on the C<Foo> package.  This
+is no longer the case.  To do a C<SUPER> lookup, pass the C<Foo> stash and the
+C<GV_SUPER> flag.
 
 =head2 C<split>'s first argument is more consistently interpreted
 
@@ -522,7 +521,7 @@ containing one space once was.
 The following modules will be removed from the core distribution in a
 future release, and should be installed from CPAN instead. Distributions
 on CPAN which require these should add them to their prerequisites.
-The core versions of these modules will issue "deprecated"-category
+The core versions of these modules will issue C<"deprecated">-category
 warnings.
 
 You can silence these deprecation warnings by installing the modules
@@ -602,12 +601,15 @@ Unicode recommends 11 characters be treated thusly.  We will conform
 with this in a future Perl version.  In the meantime, use of any of the
 missing characters will raise a deprecation warning, unless turned off.
 The five characters are:
-U+0085 NEXT LINE,
-U+200E LEFT-TO-RIGHT MARK,
-U+200F RIGHT-TO-LEFT MARK,
-U+2028 LINE SEPARATOR,
+
+    U+0085 NEXT LINE,
+    U+200E LEFT-TO-RIGHT MARK,
+    U+200F RIGHT-TO-LEFT MARK,
+    U+2028 LINE SEPARATOR,
+
 and
-U+2029 PARAGRAPH SEPARATOR.
+
+    U+2029 PARAGRAPH SEPARATOR.
 
 =head2 User-defined charnames with surprising whitespace
 
@@ -622,8 +624,7 @@ 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>.  The complete list (including some
-that were deprecated in 5.17.7) is:
+See L<perlapi/Character classes>.  The complete list is:
 C<is_uni_alnum>, C<is_uni_alnumc>, C<is_uni_alnumc_lc>,
 C<is_uni_alnum_lc>, C<is_uni_alpha>, C<is_uni_alpha_lc>,
 C<is_uni_ascii>, C<is_uni_ascii_lc>, C<is_uni_blank>,
@@ -647,7 +648,7 @@ In addition these three functions that have never worked properly are
 deprecated:
 C<to_uni_lower_lc>, C<to_uni_title_lc>, and C<to_uni_upper_lc>.
 
-=head2 Certain rare uses of backslashes within regexes are now deprectated
+=head2 Certain rare uses of backslashes within regexes are now deprecated
 
 There are three pairs of characters that Perl recognizes as
 metacharacters in regular expression patterns: C<{}>, C<[]>, and C<()>.
@@ -659,7 +660,7 @@ These can be used as well to delimit patterns, as in:
 Since they are metacharacters, they have special meaning to regular
 expression patterns, and it turns out that you can't turn off that
 special meaning by the normal means of preceding them with a backslash,
-if you use them, paired, within a pattern delimitted by them.  For
+if you use them, paired, within a pattern delimited by them.  For
 example, in
 
   m{foo\{1,3\}}
@@ -682,13 +683,22 @@ by white space or comments in C<(?...)> regular expression constructs.
 Similarly, if the C<(> and C<*> are separated in C<(*VERB...)>
 constructs.
 
+=head2 Pre-PerlIO IO implementations
+
+Perl supports being built without PerlIO proper, using a stdio or sfio
+wrapper instead.  A perl build like this will not support IO layers and
+thus Unicode IO, making it rather handicapped.
+
+PerlIO supports a C<stdio> layer if stdio use is desired, and similarly a
+sfio layer could be produced.
+
 =head1 Future Deprecations
 
 =over
 
 =item *
 
-Platforms with out support infrastructure
+Platforms without support infrastructure
 
 Both Windows CE and z/OS have been historically under-maintained, and are
 currently neither successfully building nor regularly being smoke tested.
@@ -719,17 +729,6 @@ ticket|https://rt.perl.org/rt3/Ticket/Display.html?id=96212>.
 
 =item *
 
-sfio, stdio
-
-Perl supports being built without PerlIO proper, using a stdio or sfio
-wrapper instead.  A perl build like this will not support IO layers and
-thus Unicode IO, making it rather handicapped.
-
-PerlIO supports a C<stdio> layer if stdio use is desired, and similarly a
-sfio layer could be produced.
-
-=item *
-
 C<microperl>, long broken and of unclear present purpose, will be removed.
 
 =item *
@@ -793,22 +792,17 @@ 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.
+The optimisation of hashes in boolean context has been extended to
+affect C<scalar(%hash)>, C<%hash ? ... : ...>, and C<sub { %hash || ... }>.
 
 =item *
 
-Extend the optimisation of hashes in boolean context to C<scalar(%hash)>,
-C<%hash ? ... : ...>, and C<sub { %hash || ... }>.
-
-=item *
-
-Filetest ops manage the stack in a fractionally more efficient manner.
+Filetest operators manage the stack in a fractionally more efficient manner.
 
 =item *
 
 Globs used in a numeric context are now numified directly in most cases,
-rather than being numerified via stringification.
+rather than being numified via stringification.
 
 =item *
 
@@ -837,9 +831,9 @@ information only known to the C<perl> binary and not available via L<Config>.
 This is only an overview of selected module updates.  For a complete
 list of updates, run:
 
-  $ corelist --diff 5.14.0 5.16.0
+  $ corelist --diff 5.16.0 5.18.0
 
-You can substitute your favorite version in place of 5.14.0, too.
+You can substitute your favorite version in place of 5.16.0, too.
 
 =over 4
 
@@ -1221,15 +1215,24 @@ When set, it includes 'api_versionstring' in 'archname'. E.g.
 x86_64-linux-5.13.6-thread-multi.  It is unset by default.
 
 This feature was requested by Tim Bunce, who observed that
-INSTALL_BASE creates a library structure that does not
+C<INSTALL_BASE> creates a library structure that does not
 differentiate by perl version.  Instead, it places architecture
 specific files in "$install_base/lib/perl5/$archname".  This makes
-it difficult to use a common INSTALL_BASE library path with
+it difficult to use a common C<INSTALL_BASE> library path with
 multiple versions of perl.
 
-By setting -Duseversionedarchname, the $archname will be
+By setting C<-Duseversionedarchname>, the $archname will be
 distinct for architecture I<and> API version, allowing mixed use of
-INSTALL_BASE.
+C<INSTALL_BASE>.
+
+=item *
+
+Add a C<PERL_NO_INLINE_FUNCTIONS> option
+
+If C<PERL_NO_INLINE_FUNCTIONS> is defined, don't include "inline.h"
+
+This permits test code to include the perl headers for definitions without
+creating a link dependency on the perl library (which may not exist yet).
 
 =item *
 
@@ -1367,16 +1370,17 @@ when extended parse is enabled in the process from which Perl is run.
 
 The character set for Extended Filename Syntax (EFS) is now enabled by default
 on VMS.  Among other things, this provides better handling of dots in directory
-names, multiple dots in filenames,and spaces in filenames.  To obtain the old
+names, multiple dots in filenames, and spaces in filenames.  To obtain the old
 behavior, set the logical name C<DECC$EFS_CHARSET> to C<DISABLE>.
 
 =item *
 
-Fix linking on builds configured with -Dusemymalloc=y.
+Fixed linking on builds configured with C<-Dusemymalloc=y>.
 
 =item *
 
-It should now be possible to compile Perl as C++ on VMS.
+Experimental support for building Perl with the HP C++ compiler is available
+by configuring with C<-Dusecxx>.
 
 =item *
 
@@ -1411,7 +1415,7 @@ Windows Desktop) in F<win32/Makefile>.
 
 =item *
 
-The option to build without USE_SOCKETS_AS_HANDLES has been removed.
+The option to build without C<USE_SOCKETS_AS_HANDLES> has been removed.
 
 =item *
 
@@ -1444,7 +1448,7 @@ deleting the PATH environment variable [perl #113798].
 
 =item *
 
-A new makefile option, USE_64_BIT_INT, has been added to the Windows
+A new makefile option, C<USE_64_BIT_INT>, has been added to the Windows
 makefiles.  Set this to "define" when building a 32-bit perl if you want
 it to use 64-bit integers.
 
@@ -1467,7 +1471,7 @@ to fully restore a clean build.
 
 =item *
 
-Synonyms for the misleadingly named C<av_len()> has been created:
+Synonyms for the misleadingly named C<av_len()> have been created:
 C<av_top_index()> and C<av_tindex>.  All three of these return the
 number of the highest index in the array, not the number of elements it
 contains.
@@ -1516,7 +1520,7 @@ Use the SvIsCOW macro (as before) to identify a copy-on-write scalar.
 
 =item *
 
-PL_glob_index is gone.
+C<PL_glob_index> is gone.
 
 =item *
 
@@ -1536,7 +1540,7 @@ A new op type, C<OP_PADRANGE> has been introduced.  The perl peephole
 optimiser will, where possible, substitute a single padrange op for a
 pushmark followed by one or more pad ops, and possibly also skipping list
 and nextstate ops.  In addition, the op can carry out the tasks associated
-with the RHS of a my(...) = @_ assignment, so those ops may be optimised
+with the RHS of a C<< my(...) = @_ >> assignment, so those ops may be optimised
 away too.
 
 =item *
@@ -1664,7 +1668,7 @@ holds stash pointers.
 
 In the pluggable regex API, the C<regexp_engine> struct has acquired a new
 field C<op_comp>, which is currently just for perl's internal use, and
-should be initialised to NULL by other regex plugin modules.
+should be initialized to NULL by other regex plugin modules.
 
 =item *
 
@@ -1674,7 +1678,7 @@ experimental.  See L<perlapi>.
 =item *
 
 Perl used to implement get magic in a way that would sometimes hide bugs in
-code could call mg_get() too many times on magical values.  This hiding of
+code that could call mg_get() too many times on magical values.  This hiding of
 errors no longer occurs, so long-standing bugs may become visible now.  If
 you see magic-related errors in XS code, check to make sure it, together
 with the Perl API functions it uses, calls mg_get() only once on SvGMAGICAL()
@@ -1688,13 +1692,13 @@ compilation error is simpler and safer [perl #111462][perl #112312].
 
 =item *
 
-PERL_DEBUG_READONLY_OPS has been rewritten to work with the new slab
+C<PERL_DEBUG_READONLY_OPS> has been rewritten to work with the new slab
 allocator, allowing it to catch more violations than before.
 
 =item *
 
-The old slab allocator for ops, which was only enabled for PERL_IMPLICIT_SYS
-and PERL_DEBUG_READONLY_OPS, has been retired.
+The old slab allocator for ops, which was only enabled for C<PERL_IMPLICIT_SYS>
+and C<PERL_DEBUG_READONLY_OPS>, has been retired.
 
 =back
 
@@ -1710,7 +1714,7 @@ string eval [perl #65838].
 
 =item *
 
--DPERL_GLOBAL_STRUCT builds now free the global struct B<after>
+C<-DPERL_GLOBAL_STRUCT> builds now free the global struct B<after>
 they've finished using it.
 
 =item *
@@ -1934,7 +1938,7 @@ calls STORE (it was already calling FETCH).
 
 C<$tied =~ s/$non_utf8/$utf8/> no longer loops infinitely if the tied
 variable returns a Latin-1 string, shared hash key scalar, or reference or
-typeglob that stringifies as ASCII or Latin-1.  This is a regression from
+typeglob that stringifies as ASCII or Latin-1.  This was a regression from
 5.12.x.
 
 =item *
@@ -2114,7 +2118,7 @@ SUPER package had already been accessed by other means.
 
 =item *
 
-Stash aliasing (C<*foo:: = *bar::>) no longer causes SUPER calls to ignore
+Stash aliasing (C<< *foo:: = *bar:: >>) no longer causes SUPER calls to ignore
 changes to methods or @ISA or use the wrong package.
 
 =item *
@@ -2249,10 +2253,6 @@ resolves the common problem of the F<t/op/fork.t> test hanging on Windows [perl
 
 =item *
 
-The microperl build, broken since Perl 5.15.7, has now been restored.
-
-=item *
-
 The code which generates errors from C<require()> could potentially read one or
 two bytes before the start of the filename for filenames less than three bytes
 long and ending C</\.p?\z/>.  This has now been fixed.  Note that it could
@@ -2265,6 +2265,10 @@ thread-safe on VMS.
 
 =item *
 
+Non-blocking sockets have been fixed on VMS.
+
+=item *
+
 A bug in the compilation of a C</(?{})/> expression which affected the TryCatch
 test suite has been fixed [perl #114242].
 
@@ -2488,10 +2492,9 @@ and now gives:
 
 =item *
 
-Perl now works as well as can be expected on all releases of Unicode so
-far.  In v5.16, it worked on Unicodes 6.0 and 6.1, but there were
-various bugs for earlier releases; the older the release the more
-problems.
+Perl now can be recompiled to use any Unicode version.  In v5.16, it
+worked on Unicodes 6.0 and 6.1, but there were various bugs if earlier
+releases were used; the older the release the more problems.
 
 =item *
 
@@ -2862,17 +2865,17 @@ debugging builds.
 =item *
 
 Assigning a regular expression to a scalar containing a number no longer
-causes subsequent nummification to produce random numbers.
+causes subsequent numification to produce random numbers.
 
 =item *
 
 Assigning a regular expression to a magic variable no longer wipes away the
-magic.  This is a regression from 5.10.
+magic.  This was a regression from 5.10.
 
 =item *
 
 Assigning a regular expression to a blessed scalar no longer results in
-crashes.  This is also a regression from 5.10.
+crashes.  This was also a regression from 5.10.
 
 =item *
 
@@ -2881,13 +2884,13 @@ flattening into strings.
 
 =item *
 
-Nummifying a regular expression no longer results in an uninitialized
+Numifying a regular expression no longer results in an uninitialized
 warning.
 
 =item *
 
 Negative array indices no longer cause EXISTS methods of tied variables to
-be ignored.  This is a regression from 5.12.
+be ignored.  This was a regression from 5.12.
 
 =item *