|
| 1 | +=encoding utf8 |
| 2 | + |
| 3 | +=head1 NAME |
| 4 | + |
| 5 | +perl5419delta - what is new for perl v5.41.9 |
| 6 | + |
| 7 | +=head1 DESCRIPTION |
| 8 | + |
| 9 | +This document describes differences between the 5.41.8 release and the 5.41.9 |
| 10 | +release. |
| 11 | + |
| 12 | +If you are upgrading from an earlier release such as 5.41.7, first read |
| 13 | +L<perl5418delta>, which describes differences between 5.41.7 and 5.41.8. |
| 14 | + |
| 15 | +=head1 Core Enhancements |
| 16 | + |
| 17 | +=head2 Lexical method declaration using C<my method> |
| 18 | + |
| 19 | +Like C<sub> since Perl version 5.18, C<method> can now be prefixed with the |
| 20 | +C<my> keyword. This declares a subroutine that has lexical, rather than |
| 21 | +package visibility. See L<perlclass> for more detail. |
| 22 | + |
| 23 | +=head2 Lexical method invocation operator C<< ->& >> |
| 24 | + |
| 25 | +Along with the ability to declare methods lexically, this release also permits |
| 26 | +invoking a lexical subroutine as if it were a method, bypassing the usual |
| 27 | +name-based method resolution by name. |
| 28 | + |
| 29 | +Combined with lexical method declaration, these two new abilities create the |
| 30 | +effect of having private methods. |
| 31 | + |
| 32 | +=head1 Incompatible Changes |
| 33 | + |
| 34 | +=head2 Switch and Smart Match operator reinstated |
| 35 | + |
| 36 | +The "switch" feature and the smartmatch operator, C<~~>, were introduced in |
| 37 | +v5.10. Their behavior was significantly changed in v5.10.1. When the |
| 38 | +"experiment" system was added in v5.18.0, switch and smartmatch were |
| 39 | +retroactively declared experimental. Over the years, proposals to fix or |
| 40 | +supplement the features have come and gone. |
| 41 | + |
| 42 | +They were deprecated in Perl v5.38.0 and scheduled for removal in Perl |
| 43 | +5.42.0, and entirely removed in Perl 5.41.3. |
| 44 | + |
| 45 | +After some discussion these have been re-instated. |
| 46 | + |
| 47 | +Using them no longer produces a deprecation warning. |
| 48 | + |
| 49 | +Switch itself still requires the C<switch> feature, which is enabled |
| 50 | +by default for feature bundles from v5.9.5 through to v5.34. Switch |
| 51 | +remains disabled in feature bundles 5.35 and later, but can be |
| 52 | +separately enabled: |
| 53 | + |
| 54 | + # no switch here |
| 55 | + use v5.10; |
| 56 | + # switch here |
| 57 | + use v5.36; |
| 58 | + # no switch here |
| 59 | + use feature "switch"; |
| 60 | + # switch here |
| 61 | + |
| 62 | +Smart match now requires the C<smartmatch> feature, which is enabled |
| 63 | +by default and included in all feature bundles up to 5.40. It is |
| 64 | +disabled for the 5.41 feature bundle and later, but can be separately |
| 65 | +enabled: |
| 66 | + |
| 67 | + # smartmatch here |
| 68 | + use v5.41; |
| 69 | + # no smartmatch here |
| 70 | + use feature "smartmatch"; |
| 71 | + # smartmatch here |
| 72 | + |
| 73 | +[L<GH #22752|https://github.com/Perl/perl5/issues/22752>] |
| 74 | + |
| 75 | +=head1 Performance Enhancements |
| 76 | + |
| 77 | +=over 4 |
| 78 | + |
| 79 | +=item * |
| 80 | + |
| 81 | +The stringification of integers by L<perlfunc/print> and L<perlfunc/say>, |
| 82 | +when coming from an C<SVt_IV>, is now more efficient. |
| 83 | +[L<GH #22927|https://github.com/Perl/perl5/issues/22927>] |
| 84 | + |
| 85 | +=item * |
| 86 | + |
| 87 | +Subroutines in packages no longer need to be stored in typeglobs: |
| 88 | +declaring a subroutine will now put a simple sub reference directly in the |
| 89 | +stash if possible, saving memory. The typeglob still notionally exists, |
| 90 | +so accessing it will cause the stash entry to be upgraded to a typeglob |
| 91 | +(i.e. this is just an internal implementation detail). |
| 92 | +This optimization does not currently apply to XSUBs or exported |
| 93 | +subroutines, and method calls will undo it, since they cache things in |
| 94 | +typeglobs. |
| 95 | +[L<GH #23001|https://github.com/Perl/perl5/issues/23001>] |
| 96 | + |
| 97 | +(This optimization was originally announced in L<perl5220delta>, but due to a |
| 98 | +bug it only worked for subroutines in package C<main>, not in modules.) |
| 99 | + |
| 100 | +=back |
| 101 | + |
| 102 | +=head1 Modules and Pragmata |
| 103 | + |
| 104 | +=head2 Updated Modules and Pragmata |
| 105 | + |
| 106 | +=over 4 |
| 107 | + |
| 108 | +=item * |
| 109 | + |
| 110 | +L<B::Deparse> has been upgraded from version 1.82 to 1.83. |
| 111 | + |
| 112 | +=item * |
| 113 | + |
| 114 | +L<Exporter> has been upgraded from version 5.78 to 5.79. |
| 115 | + |
| 116 | +=item * |
| 117 | + |
| 118 | +L<feature> has been upgraded from version 1.93 to 1.94. |
| 119 | + |
| 120 | +=item * |
| 121 | + |
| 122 | +L<Math::BigInt> has been upgraded from version 2.003003 to 2.003004. |
| 123 | + |
| 124 | +=item * |
| 125 | + |
| 126 | +L<Module::CoreList> has been upgraded from version 5.20250120 to 5.20250220. |
| 127 | + |
| 128 | +=item * |
| 129 | + |
| 130 | +L<ODBM_File> has been upgraded from version 1.19 to 1.20. |
| 131 | + |
| 132 | +=item * |
| 133 | + |
| 134 | +L<Opcode> has been upgraded from version 1.68 to 1.69. |
| 135 | + |
| 136 | +=item * |
| 137 | + |
| 138 | +L<overload> has been upgraded from version 1.39 to 1.40. |
| 139 | + |
| 140 | +=item * |
| 141 | + |
| 142 | +L<Safe> has been upgraded from version 2.47 to 2.46. |
| 143 | + |
| 144 | +=item * |
| 145 | + |
| 146 | +L<Test::Simple> has been upgraded from version 1.302207 to 1.302209. |
| 147 | + |
| 148 | +=item * |
| 149 | + |
| 150 | +L<Unicode::UCD> has been upgraded from version 0.78 to 0.79. |
| 151 | + |
| 152 | +=item * |
| 153 | + |
| 154 | +L<warnings> has been upgraded from version 1.72 to 1.73. |
| 155 | + |
| 156 | +=back |
| 157 | + |
| 158 | +=head1 Diagnostics |
| 159 | + |
| 160 | +The following additions or changes have been made to diagnostic output, |
| 161 | +including warnings and fatal error messages. For the complete list of |
| 162 | +diagnostic messages, see L<perldiag>. |
| 163 | + |
| 164 | +=head2 New Diagnostics |
| 165 | + |
| 166 | +=head3 New Errors |
| 167 | + |
| 168 | +=over 4 |
| 169 | + |
| 170 | +=item * |
| 171 | + |
| 172 | +L<Undefined subroutine &%s called, close to label '%s'|perldiag/"Undefined subroutine &%s called, close to label '%s'"> |
| 173 | + |
| 174 | +(F) The subroutine indicated hasn't been defined, or if it was, it has |
| 175 | +since been undefined. |
| 176 | + |
| 177 | +This error could also indicate a mistyped package separator, when a |
| 178 | +single colon was typed instead of two colons. For example, C<Foo:bar()> |
| 179 | +would be parsed as the label C<Foo> followed by an unqualified function |
| 180 | +name: C<foo: bar()>. [L<GH #22860|https://github.com/Perl/perl5/issues/22860>] |
| 181 | + |
| 182 | +=back |
| 183 | + |
| 184 | +=head2 Changes to Existing Diagnostics |
| 185 | + |
| 186 | +=over 4 |
| 187 | + |
| 188 | +=item * |
| 189 | + |
| 190 | +L<Possible precedence problem between ! and %s|perldiag/"Possible precedence problem between ! and %s"> |
| 191 | + |
| 192 | +This warning no longer triggers for code like C<!!$x == $y>, i.e. where double |
| 193 | +negation (C<!!>) is used as a convert-to-boolean operator. |
| 194 | +[L<GH #22954|https://github.com/Perl/perl5/issues/22954>] |
| 195 | + |
| 196 | +=item * |
| 197 | + |
| 198 | +L<Useless use of %s in void context|perldiag/"Useless use of %s in void context"> |
| 199 | + |
| 200 | +This warning now triggers for use of a chained comparison like C<< 0 < $x < 1 >>. |
| 201 | +[L<GH #22969|https://github.com/Perl/perl5/issues/22969>] |
| 202 | + |
| 203 | +=back |
| 204 | + |
| 205 | +=head1 Internal Changes |
| 206 | + |
| 207 | +=over 4 |
| 208 | + |
| 209 | +=item * |
| 210 | + |
| 211 | +Two new API functions are introduced to convert strings encoded in |
| 212 | +native bytes format to UTF-8. These return the string unchanged if its |
| 213 | +UTF-8 representation is the same as the original. Otherwise, new memory |
| 214 | +is allocated to contain the converted string. This is in contrast to |
| 215 | +the existing L<perlapi/C<bytes_to_utf8>> which always allocates new |
| 216 | +memory. The new functions are L<perlapi/C<bytes_to_utf8_free_me>> and |
| 217 | +L<perlapi/C<bytes_to_utf8_temp_pv>>. |
| 218 | +L<perlapi/C<bytes_to_utf8_temp_pv>> arranges for the new memory to |
| 219 | +automatically be freed. With C<bytes_to_utf8_free_me>, you are |
| 220 | +responsible for freeing any newly allocated memory. |
| 221 | + |
| 222 | +=item * |
| 223 | + |
| 224 | +The way that subroutine signatures are parsed by the parser grammar has been |
| 225 | +changed. |
| 226 | + |
| 227 | +Previously, when parsing individual signature parameters, the parser would |
| 228 | +accumulate an C<OP_ARGELEM> optree fragment for each parameter on the parser |
| 229 | +stack, collecting them in an C<OP_LIST> sequence, before finally building the |
| 230 | +complete argument handling optree itself, in a large action block defined |
| 231 | +directly in F<perly.y>. |
| 232 | + |
| 233 | +In the new approach, all the optree generation is handled by newly-defined |
| 234 | +functions in F<op.c> which are called by the action blocks in the parser. |
| 235 | +These do not keep state on the parser stack, but instead in a dedicated memory |
| 236 | +structure referenced by the main C<PL_parser> structure. This is intended to |
| 237 | +be largely opaque to other code, and accessed only via the new functions. |
| 238 | + |
| 239 | +This new arrangement is intended to allow more flexible code generation and |
| 240 | +additional features to be developed in future. |
| 241 | + |
| 242 | +=back |
| 243 | + |
| 244 | +=head1 Selected Bug Fixes |
| 245 | + |
| 246 | +=over 4 |
| 247 | + |
| 248 | +=item * |
| 249 | + |
| 250 | +The C<$SIG{__DIE__}> and C<$SIG{__WARN__}> handlers can no longer be invoked |
| 251 | +recursively, either deliberately or by accident, as described in |
| 252 | +L<perlvar/%SIG>. That is, when an exception (or warning) triggers a call to a |
| 253 | +C<$SIG{__DIE__}> (or C<$SIG{__WARN__}>) handler, further exceptions (or |
| 254 | +warnings) are processed directly, ignoring C<%SIG> until the original |
| 255 | +C<$SIG{__DIE__}> (or C<$SIG{__WARN__}>) handler call returns. |
| 256 | +[L<GH #14527|https://github.com/Perl/perl5/issues/14527>], [L<GH #22984|https://github.com/Perl/perl5/issues/22984>], [L<GH #22987|https://github.com/Perl/perl5/issues/22987>] |
| 257 | + |
| 258 | +=item * |
| 259 | + |
| 260 | +The C<ObjectFIELDS()> for an object and C<xhv_class_fields> for the |
| 261 | +object's stash weren't always NULL or not-NULL, confusing C<sv_dump()> |
| 262 | +(and hence Devel::Peek's C<Dump()>) into crashing on an object with no |
| 263 | +defined fields in some cases. [L<GH #22959|https://github.com/Perl/perl5/issues/22959>] |
| 264 | + |
| 265 | +=item * |
| 266 | + |
| 267 | +When comparing strings when using a UTF-8 locale, the behavior was |
| 268 | +previously undefined if either or both contained an above-Unicode code |
| 269 | +point, such as 0x110000. Now all such code points will collate the same |
| 270 | +as the highest Unicode code point, U+10FFFF. [L<GH #22989|https://github.com/Perl/perl5/issues/22989>] |
| 271 | + |
| 272 | +=back |
| 273 | + |
| 274 | +=head1 Acknowledgements |
| 275 | + |
| 276 | +Perl 5.41.9 represents approximately 5 weeks of development since Perl |
| 277 | +5.41.8 and contains approximately 17,000 lines of changes across 380 files |
| 278 | +from 23 authors. |
| 279 | + |
| 280 | +Excluding auto-generated files, documentation and release tools, there were |
| 281 | +approximately 9,700 lines of changes to 300 .pm, .t, .c and .h files. |
| 282 | + |
| 283 | +Perl continues to flourish into its fourth decade thanks to a vibrant |
| 284 | +community of users and developers. The following people are known to have |
| 285 | +contributed the improvements that became Perl 5.41.9: |
| 286 | + |
| 287 | +Andrew Ruthven, Antanas Vaitkus, Aristotle Pagaltzis, Chris 'BinGOs' |
| 288 | +Williams, Dan Book, Dan Jacobson, David Mitchell, Eric Herman, hbmaclean, |
| 289 | +James E Keenan, Karl Williamson, Leon Timmermans, Lukas Mai, Paul Evans, |
| 290 | +Peter John Acklam, Reini Urban, Richard Leach, Scott Baker, Steve Hay, TAKAI |
| 291 | +Kousuke, Thibault Duponchelle, Tony Cook, Yves Orton. |
| 292 | + |
| 293 | +The list above is almost certainly incomplete as it is automatically |
| 294 | +generated from version control history. In particular, it does not include |
| 295 | +the names of the (very much appreciated) contributors who reported issues to |
| 296 | +the Perl bug tracker. |
| 297 | + |
| 298 | +Many of the changes included in this version originated in the CPAN modules |
| 299 | +included in Perl's core. We're grateful to the entire CPAN community for |
| 300 | +helping Perl to flourish. |
| 301 | + |
| 302 | +For a more complete list of all of Perl's historical contributors, please |
| 303 | +see the F<AUTHORS> file in the Perl source distribution. |
| 304 | + |
| 305 | +=head1 Reporting Bugs |
| 306 | + |
| 307 | +If you find what you think is a bug, you might check the perl bug database |
| 308 | +at L<https://github.com/Perl/perl5/issues>. There may also be information at |
| 309 | +L<https://www.perl.org/>, the Perl Home Page. |
| 310 | + |
| 311 | +If you believe you have an unreported bug, please open an issue at |
| 312 | +L<https://github.com/Perl/perl5/issues>. Be sure to trim your bug down to a |
| 313 | +tiny but sufficient test case. |
| 314 | + |
| 315 | +If the bug you are reporting has security implications which make it |
| 316 | +inappropriate to send to a public issue tracker, then see |
| 317 | +L<perlsec/SECURITY VULNERABILITY CONTACT INFORMATION> |
| 318 | +for details of how to report the issue. |
| 319 | + |
| 320 | +=head1 Give Thanks |
| 321 | + |
| 322 | +If you wish to thank the Perl 5 Porters for the work we had done in Perl 5, |
| 323 | +you can do so by running the C<perlthanks> program: |
| 324 | + |
| 325 | + perlthanks |
| 326 | + |
| 327 | +This will send an email to the Perl 5 Porters list with your show of thanks. |
| 328 | + |
| 329 | +=head1 SEE ALSO |
| 330 | + |
| 331 | +The F<Changes> file for an explanation of how to view exhaustive details on |
| 332 | +what changed. |
| 333 | + |
| 334 | +The F<INSTALL> file for how to build Perl. |
| 335 | + |
| 336 | +The F<README> file for general stuff. |
| 337 | + |
| 338 | +The F<Artistic> and F<Copying> files for copyright information. |
| 339 | + |
| 340 | +=cut |
0 commit comments