|Perl Monk, Perl Meditation
Re^3: Reverting the internals of an IV to their original statesby dave_the_m (Monsignor)
|on Dec 27, 2021 at 15:23 UTC
Well the entire philosophy of the perl core for the last 25 years has been that whenever you want to access the value of an SV, you request the perl core to update that SV into the form you want, then access the appropriate slot for the value (the string or IV or whatever). For the vast majority of use cases this "just works". It's only a few edge cases (like data serialisers and bitwise operators) where this becomes an issue. Note that perl will only set the *private* versions of the flags if the conversion isn't fully accurate / reversible, such as the pIOK but not IOK in your example above.
This is very much tied to the perl language philosophy that values are type agnostic and the type of operation is specified by the operator, e.g. eq versus ==.
Although those flag changes are "unannounced", it's the sort of thing that happens to most SVs in most perl programs. I think you'd have to give a practical example of real harm being caused by these flag changes.