Unused IMPORTs
Posted: Sun Oct 09, 2016 11:51 pm
Info=>Analyze module
marks an import as "never used" if the import is not directly accessed within a module.
But that is wrong.
Why? Because it leads the user to believe the module can be deleted from the IMPORT list.
However, there are cases when doing so can lead to disaster.
Gardens Point Component Pascal uses the strategy of "cross initialization" where module B initializes module C.
IF module A imports B and C but does not use B then one would think they could remove B, however,
this leaves C uninitialized. A call by A to C can cause traps. For example in Gardens Point (Gp) in C a division by
size is performed where it is has been assumed that size has previously been set to some nonzero value. When
B is not loaded that assumption is false.
I never do "cross initialization" so have never encountered the problem before converting Gp to BlackBox.
I believe Analyze needs to be modified.
Comments?
-Doug
marks an import as "never used" if the import is not directly accessed within a module.
But that is wrong.
Why? Because it leads the user to believe the module can be deleted from the IMPORT list.
However, there are cases when doing so can lead to disaster.
Gardens Point Component Pascal uses the strategy of "cross initialization" where module B initializes module C.
IF module A imports B and C but does not use B then one would think they could remove B, however,
this leaves C uninitialized. A call by A to C can cause traps. For example in Gardens Point (Gp) in C a division by
size is performed where it is has been assumed that size has previously been set to some nonzero value. When
B is not loaded that assumption is false.
I never do "cross initialization" so have never encountered the problem before converting Gp to BlackBox.
I believe Analyze needs to be modified.
Comments?
-Doug