On Wed, 25 Jan 2023 18:45:32 -0800
Andrew Hewus Fresh <and...@afresh1.com> wrote:

> Good news!  I got all our patches updated for perl 5.36.0.  To skip the
> summary of new features, jump down to the bottom for details on how you
> can help test it.

A few months ago, I put perl 5.36.0 in a macppc's $HOME, but it wasn't
the system perl.  Yesterday, I began to use 5.36.0 with your patches
as a powerpc64's system perl.

A few weeks ago I built 5.36.0 (with no patches) for macppc both with
and without -Duse64bitint, thinking of whether to add -Duse64bitint to
our system perl.  Now, perl has 32-bit integers on 32-bit platforms
(like macppc) and 64-bit integers on 64-bit platforms.  If we add
-Duse64bitint, perl would have 64-bit integers everywhere.  I found
that perl with -Duse64bitint runs slightly slower and uses more memory,
so I'm not wanting to add -Duse64bitint now.

$ perl -E 'say ~0'
4294967295                                # without
18446744073709551615                      # with -Duse64bitint
$ perl -E 'say 1 << 40'
0                                         # without
1099511627776                             # with -Duse64bitint
$ perl -E 'say unpack("Q", "abcdefgh")'
Invalid type 'Q' in unpack at -e line 1.  # without
7017280452245743464                       # with -Duse64bitint

> The feature that I'm most excited for, and probably what will make me
> `use v5.36` in my scripts is multi-value iteration.  Examples from the
> docs:
> 
>     for my ($key, $value) (%hash) { ... }
>     for my ($left, $right, $gripping) (@moties) { ... }

The for_list is still experimental, so if I decide to use it, I will
turn off the warning,

  use v5.36;
  use experimental 'for_list';

  for my ($k, $v) (%ENV) {
    say "$k=$v";
  }

This ($k, $v) iterates 2 values at a time.  The for_list can't iterate
$n values at a time if $n is variable.  List::MoreUtils::natatime is
awkward; I might copy the n-ary example from "perldoc -f splice".

--George

Reply via email to