Subject: | Make bignums (optionally) immutable |
Bignums do not behave like normal numbers when modifying operations are
used.
Consider:
sub foo($) {
my($num) = @_; $num /= 1000;
}
my $num = new Math::BigInt 12345;
foo($num);
print "This <$num> should be <12345>.\n";
In other words, replacing integers with bigint in one part of a program
can have serious consequences somewhere seemingly unrelated.
The solution would be either to use CoW (preferred ;-) , or be able to
mark numbers as immutable, so that self-modifying operators throw an error.