Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 6edc33d41c241e28440f8fea3d8f1c8ea5d95a56
      
https://github.com/Perl/perl5/commit/6edc33d41c241e28440f8fea3d8f1c8ea5d95a56
  Author: TAKAI Kousuke <62541129+t-...@users.noreply.github.com>
  Date:   2025-07-15 (Tue, 15 Jul 2025)

  Changed paths:
    M pod/perldelta.pod
    M pp.c
    M pp_hot.c
    M t/lib/warnings/9uninit

  Log Message:
  -----------
  pp.c, pp_hot.c: Reorder SvXV_nomg() to fetch operands in left-to-right order

Some binary (2-operand) operators, notably arithmetic add (+) and
subtract (-), used to fetch its RHS operand first then LHS one,
so they would issue "use of uninitialized value" warnings in
right-to-left order:

 % perl -wle 'print $a + $b'
 Use of uninitialized value $b in addition (+) at -e line 1.
 Use of uninitialized value $a in addition (+) at -e line 1.
 0
 %

I think this is not intuitive for users, as "perlop" says that
"Perl has a general rule that the operands of an operator are evaluated
in left-to-right order."  (3-operand case is more surprising;
"print $a + $b + $c" will warn in the order $b, $a, $c.)

This change reverses the operand fetch order in these operators
to issue warnings in left-to-right order.

t/lib/warnings/9uninit: Reorder expected warnings in left-to-right order.

pod/perldelta.pod: Add perldelta entry for this change.


  Commit: dbbbb38f2754860677e5d42b5625b56785dccd23
      
https://github.com/Perl/perl5/commit/dbbbb38f2754860677e5d42b5625b56785dccd23
  Author: TAKAI Kousuke <62541129+t-...@users.noreply.github.com>
  Date:   2025-07-15 (Tue, 15 Jul 2025)

  Changed paths:
    M pp.c
    M pp_hot.c

  Log Message:
  -----------
  pp_add, pp_subtract: Unify TARGn(<result>, 1) calls into a single call

Before this change, pp_add() and pp_subtract() had two (or three
before the previous commit) calls of TARGn(<result>, 1) for each.
Consolidating these calls into single call will (slightly) reduce
the size of the compiled code.


  Commit: e78ee042624f37795abc6d43d9a40b5e2a0f9172
      
https://github.com/Perl/perl5/commit/e78ee042624f37795abc6d43d9a40b5e2a0f9172
  Author: TAKAI Kousuke <62541129+t-...@users.noreply.github.com>
  Date:   2025-07-15 (Tue, 15 Jul 2025)

  Changed paths:
    M pod/perldelta.pod

  Log Message:
  -----------
  perldelta.pod: describe the bug where "0+" methods were sometimes called in 
reverse order

The previous commit "pp.c, pp_hot.c: Reorder SvXV_nomg() to fetch operands
in left-to-right order" will not only change the order of "Use of
uninialized value" warnings, but actually also change the order of
the call of "0+" overloading methods for each operands.


Compare: https://github.com/Perl/perl5/compare/d349122ed895...e78ee042624f

To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to