in reply to Re: Action at a distance
in thread Action at a distance
My favourite workaround for this is to write $x = $bi * 1;
Yes, that works fine ... for those who:
1) are aware that it's needed;
and
2) remember to do it.
I'd like a better solution, but I don't yet see that one exists.
You can also work around the problem by doing $x = Math::BigInt->new($bi), but the brevity of doing $x = $bi is a very attractive alternative ... or, at least, would be if it DWIMmed.
Doing $x = $bi will not call the sub that overloads '=' until an attempted modification of the value of $x has been detected and, while doing $x++ triggers that detection, doing $x->binc() apparently does not.
Thanks for the thoughts so far.
Is there something already posted in this thread to which I should pay more attention ?
Cheers,
Rob
Yes, that works fine ... for those who:
1) are aware that it's needed;
and
2) remember to do it.
I'd like a better solution, but I don't yet see that one exists.
You can also work around the problem by doing $x = Math::BigInt->new($bi), but the brevity of doing $x = $bi is a very attractive alternative ... or, at least, would be if it DWIMmed.
Doing $x = $bi will not call the sub that overloads '=' until an attempted modification of the value of $x has been detected and, while doing $x++ triggers that detection, doing $x->binc() apparently does not.
Thanks for the thoughts so far.
Is there something already posted in this thread to which I should pay more attention ?
Cheers,
Rob
|
---|
In Section
Seekers of Perl Wisdom