in reply to Re: Pragma clash across modules: bignum and Math::BigFloat
in thread Pragma clash across modules: bignum and Math::BigFloat
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Pragma clash across modules: bignum and Math::BigFloat (hinthash)
by Anonymous Monk on Dec 07, 2016 at 22:36 UTC | |
by LanX (Saint) on Dec 07, 2016 at 23:06 UTC | |
by Anonymous Monk on Dec 08, 2016 at 00:23 UTC | |
by LanX (Saint) on Dec 08, 2016 at 00:39 UTC | |
by Anonymous Monk on Dec 08, 2016 at 01:06 UTC | |
|