I haven't checked in detail yet (the code is a bit obscure) but this sounds reasonable.
But I disagree when you say
> There's really no way for bignum to do the right thing. It would have to muck around with those globals every time the flow of control entered or left its lexical scope. And the automatic upgrade feature was just a bad idea from the start. Solution: Don't use bignum, I'm afraid.
Athanasius point was not why bignum fails but why the use of pragma bignum is effecting a completely other package, since pragmas are guaranteed to be limited to a scope.
It's rather a limitation of BigFloat and BigInt to use global variable which keep their state even if the scope is left.
perlpragma shows a clear mechanism to limit effects to the scope using a pragma with the help of the hinthash %H .
Since "bignum is just a thin wrapper around various modules of the Math::BigInt family" those modules should be modified in a way to check a delegated hinthash when called from a pragma. (N.B. they share the same authors)
Hence a bug, in my humble opinion.
Anyway using globals for such profound effects is never a good idea.
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
according to perlglossary#P
- pragma
A standard module whose practical hints and suggestions are received (and possibly ignored) at compile time. Pragmas are named in all lowercase.
I'm not sure if bignum qualifies as a pragma, because of it's rather runtime effects.
In reply to Re^2: Pragma clash across modules: bignum and Math::BigFloat (hinthash)
by LanX
in thread Pragma clash across modules: bignum and Math::BigFloat
by Athanasius
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |