This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Deprecate above \xFF in bitwise string ops
[perl5.git] / pod / perldeprecation.pod
index 31c9b57..8cd3eb9 100644 (file)
@@ -50,8 +50,74 @@ changes to the variable that it closes over, add an explicit C<return>:
 
 This usage has been deprecated, and will no longer be allowed in Perl 5.32.
 
+=head3 Use of strings with code points over 0xFF as arguments to C<vec>
+
+C<vec> views its string argument as a sequence of bits.  A string
+containing a code point over 0xFF is nonsensical.  This usage is
+deprecated in Perl 5.28, and will be removed in Perl 5.32.
+
+=head3 Use of code points over 0xFF in string bitwise operators
+
+The string bitwise operators, C<&>, C<|>, C<^>, and C<~>, treat their
+operands as strings of bytes. As such, values above 0xFF are
+nonsensical. Some instances of these have been deprecated since Perl
+5.24, and were made fatal in 5.28, but it turns out that in cases where
+the wide characters did not affect the end result, no deprecation
+notice was raised, and so remain legal.  Now, all occurrences either are
+fatal or raise a deprecation warning, so that the remaining legal
+occurrences will be fatal in 5.32.
+
+An example of this is
+
+ "" & "\x{100}"
+
+The wide character is not used in the C<&> operation because the left
+operand is shorter.  This now warns anyway.
+
+=head3 hostname() doesn't accept any arguments
+
+The function C<hostname()> in the L<Sys::Hostname> module has always
+been documented to be called with no arguments.  Historically it has not
+enforced this, and has actually accepted and ignored any arguments.  As a
+result, some users have got the mistaken impression that an argument does
+something useful.  To avoid these bugs, the function is being made strict.
+Passing arguments was deprecated in Perl 5.28, and will become fatal in
+Perl 5.32.
+
 =head2 Perl 5.30
 
+=head3 C<< $* >> is no longer supported
+
+Before Perl 5.10, setting C<< $* >> to a true value globally enabled
+multi-line matching within a string. This relique from the past lost
+its special meaning in 5.10. Use of this variable will be a fatal error
+in Perl 5.30, freeing the variable up for a future special meaning.
+
+To enable multiline matching one should use the C<< /m >> regexp
+modifier (possibly in combination with C<< /s >>). This can be set
+on a per match bases, or can be enabled per lexical scope (including
+a whole file) with C<< use re '/m' >>.
+
+=head3 C<< $# >> is no longer supported
+
+This variable used to have a special meaning -- it could be used
+to control how numbers were formatted when printed. This seldom
+used functionality was removed in Perl 5.10. In order to free up
+the variable for a future special meaning, its use will be a fatal
+error in Perl 5.30.
+
+To specify how numbers are formatted when printed, one is adviced
+to use C<< printf >> or C<< sprintf >> instead.
+
+=head3 Assigning non-zero to C<< $[ >> will be fatal
+
+This variable (and the corresponding C<array_base> feature and
+L<arybase> module) allows changing the base for array and string
+indexing operations.
+
+Setting this to a non-zero value has been deprecated since Perl 5.12 and
+will become fatal in Perl 5.30.
+
 =head3 C<< File::Glob::glob() >> will disappear
 
 C<< File::Glob >> has a function called C<< glob >>, which just calls
@@ -99,7 +165,7 @@ and an unqualified C<dump()> will no longer be available in Perl 5.30.
 See L<perlfunc/dump>.
 
 
-=head2 Using my() in false conditional.
+=head3 Using my() in false conditional.
 
 There has been a long-standing bug in Perl that causes a lexical variable
 not to be cleared at scope exit when its declaration includes a false
@@ -153,26 +219,102 @@ C<:utf8> layer.
 In Perl 5.30, it will no longer be possible to use sysread(), recv(),
 syswrite() or send() to read or send bytes from/to :utf8 handles.
 
+
+=head3 Use of unassigned code point or non-standalone grapheme for a delimiter.
+
+A grapheme is what appears to a native-speaker of a language to be a
+character.  In Unicode (and hence Perl) a grapheme may actually be
+several adjacent characters that together form a complete grapheme.  For
+example, there can be a base character, like "R" and an accent, like a
+circumflex "^", that appear when displayed to be a single character with
+the circumflex hovering over the "R".  Perl currently allows things like
+that circumflex to be delimiters of strings, patterns, I<etc>.  When
+displayed, the circumflex would look like it belongs to the character
+just to the left of it.  In order to move the language to be able to
+accept graphemes as delimiters, we have to deprecate the use of
+delimiters which aren't graphemes by themselves.  Also, a delimiter must
+already be assigned (or known to be never going to be assigned) to try
+to future-proof code, for otherwise code that works today would fail to
+compile if the currently unassigned delimiter ends up being something
+that isn't a stand-alone grapheme.  Because Unicode is never going to
+assign
+L<non-character code points|perlunicode/Noncharacter code points>, nor
+L<code points that are above the legal Unicode maximum|
+perlunicode/Beyond Unicode code points>, those can be delimiters, and
+their use won't raise this warning.
+
+In Perl 5.30, delimiters which are unassigned code points, or which
+are non-standalone graphemes will be fatal.
+
+=head3 In XS code, use of various macros dealing with UTF-8.
+
+These macros will require an extra parameter in Perl 5.30:
+C<isALPHANUMERIC_utf8>,
+C<isASCII_utf8>,
+C<isBLANK_utf8>,
+C<isCNTRL_utf8>,
+C<isDIGIT_utf8>,
+C<isIDFIRST_utf8>,
+C<isPSXSPC_utf8>,
+C<isSPACE_utf8>,
+C<isVERTWS_utf8>,
+C<isWORDCHAR_utf8>,
+C<isXDIGIT_utf8>,
+C<isALPHANUMERIC_LC_utf8>,
+C<isALPHA_LC_utf8>,
+C<isASCII_LC_utf8>,
+C<isBLANK_LC_utf8>,
+C<isCNTRL_LC_utf8>,
+C<isDIGIT_LC_utf8>,
+C<isGRAPH_LC_utf8>,
+C<isIDCONT_LC_utf8>,
+C<isIDFIRST_LC_utf8>,
+C<isLOWER_LC_utf8>,
+C<isPRINT_LC_utf8>,
+C<isPSXSPC_LC_utf8>,
+C<isPUNCT_LC_utf8>,
+C<isSPACE_LC_utf8>,
+C<isUPPER_LC_utf8>,
+C<isWORDCHAR_LC_utf8>,
+C<isXDIGIT_LC_utf8>,
+C<toFOLD_utf8>,
+C<toLOWER_utf8>,
+C<toTITLE_utf8>,
+and
+C<toUPPER_utf8>.
+
+There is now a macro that corresponds to each one of these, simply by
+appending C<_safe> to the name.  It takes the extra parameter.
+For example, C<isDIGIT_utf8_safe> corresponds to C<isDIGIT_utf8>, but
+takes the extra parameter, and its use doesn't generate a deprecation
+warning.  All are documented in L<perlapi/Character case changing> and
+L<perlapi/Character classification>.
+
+You can change to use these versions at any time, or, if you can live
+with the deprecation messages, wait until 5.30 and add the parameter to
+the existing calls, without changing the names.
+
 =head2 Perl 5.28
 
-=head3 Attribute "%s" is deprecated, and will disappear in 5.28
+=head3 Attributes C<< :locked >> and C<< :unique >>
 
 The attributes C<< :locked >> (on code references) and C<< :unique >>
 (on array, hash and scalar references) have had no effect since 
 Perl 5.005 and Perl 5.8.8 respectively. Their use has been deprecated
 since.
 
-These attributes will no longer be recognized in Perl 5.28, and will
-then result in a syntax error. Since the attributes do not do anything,
-removing them from your code fixes the deprecation warning; and removing
-them will not influence the behaviour of your code.
+As of Perl 5.28, these attributes are syntax errors. Since the
+attributes do not do anything, removing them from your code fixes
+the syntax error; and removing them will not influence the behaviour
+of your code.
 
 
 =head3 Bare here-document terminators
 
 Perl has allowed you to use a bare here-document terminator to have the
 here-document end at the first empty line. This practise was deprecated
-in Perl 5.000, and this will be a fatal error in Perl 5.28.
+in Perl 5.000; as of Perl 5.28, using a bare here-document terminator
+throws a fatal error.
 
 You are encouraged to use the explictly quoted form if you wish to
 use an empty line as the terminator of the here-document:
@@ -195,7 +337,8 @@ In Perl 5.20.0 this was changed so that it would be B<exactly> the same as
 setting C<$/> to undef, with the exception that this warning would be
 thrown.
 
-In Perl 5.28, this will throw a fatal error.
+As of Perl 5.28, setting C<$/> to a reference of a non-positive
+integer throws a fatal error.
 
 You are recommended to change your code to set C<$/> to C<undef> explicitly
 if you wish to slurp the file.
@@ -203,39 +346,39 @@ if you wish to slurp the file.
 
 =head3 Limit on the value of Unicode code points.
 
-Unicode only allows code points up to 0x10FFFF, but Perl allows much
-larger ones. However, using code points exceeding the maximum value
-of an integer (C<IV_MAX>) may break the perl interpreter in some constructs,
-including causing it to hang in a few cases.  The known problem areas
-are in C<tr///>, regular expression pattern matching using quantifiers,
-as quote delimiters in C<qI<X>...I<X>> (where I<X> is the C<chr()> of a large
-code point), and as the upper limits in loops.
+Unicode only allows code points up to 0x10FFFF, but Perl allows
+much larger ones. Up till Perl 5.28, it was allowed to use code
+points exceeding the maximum value of an integer (C<IV_MAX>).
+However, that did break the perl interpreter in some constructs,
+including causing it to hang in a few cases.  The known problem
+areas were in C<tr///>, regular expression pattern matching using
+quantifiers, as quote delimiters in C<qI<X>...I<X>> (where I<X> is
+the C<chr()> of a large code point), and as the upper limits in
+loops.
 
-The use of out of range code points was deprecated in Perl 5.24, and
-it will be a fatal error in Perl 5.28.
+The use of out of range code points was deprecated in Perl 5.24; as of
+Perl 5.28 using a code point exceeding C<IV_MAX> throws a fatal error.
 
 If your code is to run on various platforms, keep in mind that the upper
-limit depends on the platform.  It is much larger on 64-bit word sizes
-than 32-bit ones.
+limit depends on the platform. It is much larger on 64-bit word sizes
+than 32-bit ones. For 32-bit integers, C<IV_MAX> equals C<0x7FFFFFFF>,
+for 64-bit integers, C<IV_MAX> equals C<0x7FFFFFFFFFFFFFFF>.
 
 
 =head3 Use of comma-less variable list in formats.
 
-It's allowed to use a list of variables in a format, without
+It was allowed to use a list of variables in a format, without
 separating them with commas. This usage has been deprecated
-for a long time, and it will be a fatal error in Perl 5.28.
-
-
+for a long time, and as of Perl 5.28, this throws a fatal error.
 
 =head3 Use of C<\N{}>
 
 Use of C<\N{}> with nothing between the braces was deprecated in
-Perl 5.24, and will throw a fatal error in Perl 5.28.
+Perl 5.24, and throws a fatal error as of Perl 5.28.
 
 Since such a construct is equivalent to using an empty string,
 you are recommended to remove such C<\N{}> constructs.
 
-
 =head3 Using the same symbol to open a filehandle and a dirhandle
 
 It used to be legal to use C<open()> to associate both a
@@ -244,36 +387,10 @@ This idiom is likely to be confusing, and it was deprecated in
 Perl 5.10.
 
 Using the same symbol to C<open()> a filehandle and a dirhandle
-will be a fatal error in Perl 5.28.
+throws a fatal error as of Perl 5.28.
 
 You should be using two different symbols instead.
 
-
-
-=head3 Use of "goto" to jump into a construct.
-
-Use of C<goto> to jump from an outer scope into an inner scope was
-deprecated in Perl 5.12, and it will be a fatal error in Perl 5.28.
-
-This means, you should not write constructs like:
-
-   $x = 1;
-   while ($x) {
-       $foo = 1;
-     LABEL:
-       $bar = 1;
-   }
-   goto LABEL;
-
-This will jump into the block belonging to C<while>. Not only has 
-been this a cause of subtle bugs in the past, it's generally
-considered to lead to hard to understand programs.
-
-This means, soon it's not possible anymore to write
-L<Duff's device|https://www.lysator.liu.se/c/duffs-device.html> in pure Perl.
-But you never wanted to do this anyway.
-
-
 =head3 ${^ENCODING} is no longer supported.
 
 The special variable C<${^ENCODING}> was used to implement
@@ -281,26 +398,27 @@ the C<encoding> pragma. Setting this variable to anything other
 than C<undef> was deprecated in Perl 5.22. Full deprecation
 of the variable happened in Perl 5.25.3.
 
-Setting this variable will become a fatal error in Perl 5.28.
+Setting this variable to anything other than an undefined value
+throws a fatal error as of Perl 5.28.
 
 
 =head3 C<< B::OP::terse >>
 
 This method, which just calls C<< B::Concise::b_terse >>, has been
-deprecated, and will disappear in Perl 5.28. Please use 
+deprecated, and disappeared in Perl 5.28. Please use 
 C<< B::Concise >> instead.
 
 
 
-=head3 Use of inherited AUTOLOAD for non-method %s() is deprecated
+=head3 Use of inherited AUTOLOAD for non-method %s::%s() is no longer allowed
 
-As an (ahem) accidental feature, C<AUTOLOAD> subroutines are looked
+As an (ahem) accidental feature, C<AUTOLOAD> subroutines were looked
 up as methods (using the C<@ISA> hierarchy) even when the subroutines
 to be autoloaded were called as plain functions (e.g. C<Foo::bar()>),
 not as methods (e.g. C<< Foo->bar() >> or C<< $obj->bar() >>).
 
-This bug will be rectified in future by using method lookup only for
-methods' C<AUTOLOAD>s.
+This bug was deprecated in Perl 5.004, has been rectified in Perl 5.28
+by using method lookup only for methods' C<AUTOLOAD>s.
 
 The simple rule is:  Inheritance will not work when autoloading
 non-methods.  The simple fix for old code is:  In any module that used
@@ -312,35 +430,23 @@ In code that currently says C<use AutoLoader; @ISA = qw(AutoLoader);>
 you should remove AutoLoader from @ISA and change C<use AutoLoader;> to
 C<use AutoLoader 'AUTOLOAD';>.
 
-This feature was deprecated in Perl 5.004, and will be fatal in Perl 5.28.
-
-
-=head3 Use of C<< \cI<X> >> to specify a printable character.
-
-In a double quoted context, Perl has the C<< \c >> construct to write
-control characters in a readable way. For instance, the tab character
-can be written as C<< \cI >> (I<< control-I >>), and the escape 
-character can be written as C<< \c[ >>.
-
-Due to implementation details, the C<< \c >> construct can be used
-to create regular, printable, characters as well. For instance,
-C<< \c >> maps a C<< , >> to C<< l >>; that is C<< \c, >> is an
-obscure way of writing C<< l >>. And not only that, it's also not
-portable between ASCII and EBCDIC platforms.
-
-Using the C<< \c >> construct with an argument which maps to a
-printable character was deprecated in Perl 5.14, and will be a fatal
-error in Perl 5.28. You're recommended to just write the intended
-character instead.
-
 
 =head3 Use of code points over 0xFF in string bitwise operators
 
 The string bitwise operators, C<&>, C<|>, C<^>, and C<~>, treat
 their operands as strings of bytes. As such, values above 0xFF 
 are nonsensical. Using such code points with these operators
-was deprecated in Perl 5.24, and will be fatal in Perl 5.28.
+was deprecated in Perl 5.24, and is fatal as of Perl 5.28.
+
+=head3 In XS code, use of C<to_utf8_case()>
 
+This function has been removed as of Perl 5.28; instead convert to call
+the appropriate one of:
+L<C<toFOLD_utf8_safe>|perlapi/toFOLD_utf8_safe>.
+L<C<toLOWER_utf8_safe>|perlapi/toLOWER_utf8_safe>,
+L<C<toTITLE_utf8_safe>|perlapi/toTITLE_utf8_safe>,
+or
+L<C<toUPPER_utf8_safe>|perlapi/toUPPER_utf8_safe>.
 
 =head2 Perl 5.26
 
@@ -349,13 +455,13 @@ was deprecated in Perl 5.24, and will be fatal in Perl 5.28.
 Since Perl 5.18, the option C<< --libpods >> has been deprecated, and
 using this option did not do anything other than producing a warning.
 
-The C<< --libpods >> option is no longer recognized in Perl 5.26.
+The C<< --libpods >> option is no longer recognized as of Perl 5.26.
 
 
 =head3 The utilities C<< c2ph >> and C<< pstruct >>
 
 These old, perl3-era utilities have been deprecated in favour of
-C<< h2xs >> for a long time. In Perl 5.26, they have been removed.
+C<< h2xs >> for a long time. As of Perl 5.26, they have been removed.
 
 
 =head3 Trapping C<< $SIG {__DIE__} >> other than during program exit.
@@ -369,7 +475,7 @@ pending exception is actually a useful feature, and not a bug.
 
 Perl never issued a deprecation warning for this; the deprecation
 was by documentation policy only. But this deprecation has been 
-lifted in Perl 5.26.
+lifted as of Perl 5.26.
 
 
 =head3 Malformed UTF-8 string in "%s"
@@ -423,39 +529,6 @@ To tie the handle, use C<tie *$scalar> (with an explicit asterisk).  The same
 applies to C<tied *$scalar> and C<untie *$scalar>.
 
 
-=head2 Perl 5.10
-
-=head3 $* is no longer supported
-
-C<$*> was once a magic variable. C<$*> enabled or disabled
-multi-line matching within a string. Deprecated since Perl 5.000,
-its special meaning was removed in Perl 5.10. Aftwards, an
-deprecation message was issued when using this variable; this message
-was discontinued in Perl 5.26.
-
-Instead of using C<$*> you should use the C</m> (and maybe C</s>) regexp
-modifiers.  You can enable C</m> for a lexical scope (even a whole file)
-with C<use re '/m'>.  (In older versions: when C<$*> was set to a true value
-then all regular expressions behaved as if they were written using C</m>.)
-
-Although you can use C<$*> as a normal variable, you are discouraged 
-from doing so.
-
-=head3 $# is no longer supported
-
-C<$#> was once a magic variable. C<$#> could be used to format
-printed numbers. Deprecated since Perl 5.000,
-its special meaning was removed in Perl 5.10. Aftwards, an
-deprecation message was issued when using this variable; this message
-was discontinued in Perl 5.26.
-
-Instead of using C<$#>, you should be using C<(s)printf> to format
-your numbers.
-
-Although you can use C<$#> as a normal variable, you are discouraged 
-from doing so.
-
-
 =head1 SEE ALSO
 
 L<warnings>, L<diagnostics>.