Really, no way to check?! Crickey.
I take your point about "my" application, but still think it is better to
maintain the status quo at all times. For example I might have a "utility"
function that I use all the time, and part of that util function generates
warnings that it wants to supress. Its "purpose" is, for example, to delete
some records, its "purpose" is *not* to adjust the system state. My calling
routine may (for whatever reason) specifically want warnings ON. So this
rules out "cleanly" using the utility routine as a nested function as my
system state prior to calling the util function is now different to the
system state post calling the util function despite the fact its purpose was
only to delete records and not to adjust my system state.
The only way to avoid this, assuming there is no way to check the warnings
state, is to
1. Adjust the utils code to take as a parameter an indication of whether it
should reinstate warnings or not; or
2. Reset the warnings state to ON again (in this example) immediatelly after
calling the util function.
Neither seems clean to me, 1 is a fudge and 2 is fixing an accidental side
effect.
Thanks for the help everyone.
A