Consistent import

Post Reply
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Consistent import

Post by DGDanforth »

Folks,

When compiling an old module I got the error message
" MyVectors.Vector is not consistently imported
"
but that does not tell me which modules are inconsistent.

It would be very nice if a list (or tree?) were presented showing
the inconsistent modules.

Doug
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Consistent import

Post by Josef Templ »

If the imports are processed in textual order, I assume so but I have not checked it, then move the import that produces the inconsistency to the start of the import list. Then compile again and see which module produces the message now. That is the module you are looking for.

- Josef
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: Consistent import

Post by DGDanforth »

Josef Templ wrote:If the imports are processed in textual order, I assume so but I have not checked it, then move the import that produces the inconsistency to the start of the import list. Then compile again and see which module produces the message now. That is the module you are looking for.

- Josef
"move the import that produces the inconsistency"
But I don't know which import produces the inconsistency!
When I compile module A which has an import list L the compiler
just says module X is inconsistently imported.
Do you mean to move module X to the head of the import list?
Well, in my case X does not occur within L. It is imported
by some subset of the modules in L.

Doug
cfbsoftware
Posts: 204
Joined: Wed Sep 18, 2013 10:06 pm
Contact:

Re: Consistent import

Post by cfbsoftware »

You can use Info > Dependency to draw a dependency graph and Info > Create Tool to generate a set of commands to recompile everything in the correct order.

However, as far as I can see, these commands require object files :( . As your top-level module fails to compile you might need to create a tool for each item in your import list and run each of those tools to perform recompiles of the lower level modules first.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Consistent import

Post by Josef Templ »

I see, the error position is not very specific.
This is because for some reason the compiler checks for inconsistencies not
during the import but only later on before creating an object file.
But there is another approach that really works.

Comment out all the code of your module except for the import statement.
Recompile. Should not produce any error message now.
Then, try to load this module by executing some dummy procedure (that does not exist).
The loading will fail with an inconsistency message that reads like this:

command error: object A.R inconsistently imported from B

Then you know that you have to recompile B.

Hope this helps.

- Josef
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: Consistent import

Post by DGDanforth »

Josef Templ wrote:I see, the error position is not very specific.
This is because for some reason the compiler checks for inconsistencies not
during the import but only later on before creating an object file.
But there is another approach that really works.

Comment out all the code of your module except for the import statement.
Recompile. Should not produce any error message now.
Then, try to load this module by executing some dummy procedure (that does not exist).
The loading will fail with an inconsistency message that reads like this:

command error: object A.R inconsistently imported from B

Then you know that you have to recompile B.

Hope this helps.

- Josef
Unfortunately that is not what I see. Here is a screen dump of what the
compiler produces after the body text has been folded out
Attachments
ScreenSave.jpg
ScreenSave.jpg (38.44 KiB) Viewed 10795 times
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Consistent import

Post by Robert »

There is a module, on CPC, called WandsTracer, that can analyze import lists, and generate compile lists.

A full recursive report of all imports, including the Oms modules, can be very large! However if you just ask for the compile list excluding Oms modules the report is quite reasonable. I show below the import dependancies for WandsTracer itself.
Attachments
WandsTracer.pdf
Compile list report
(28.03 KiB) Downloaded 361 times
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: Consistent import

Post by DGDanforth »

Robert wrote:There is a module, on CPC, called WandsTracer, that can analyze import lists, and generate compile lists.

A full recursive report of all imports, including the Oms modules, can be very large! However if you just ask for the compile list excluding Oms modules the report is quite reasonable. I show below the import dependancuies for WandsTracer itself.
Thank you Robert. I'll look at it.

Doug
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Consistent import

Post by Josef Templ »

In some situations (public fingerprint changed) the compiler emits the error message right at the module import.
In other situations (only the private fingerprint changed, e.g. by adding or removing a non-exported field from
an exported type) the error message is delayed until that object (typically a type) is really used and there is no meaningful position.
In any case there is also some info displayed in the LOG window.
This should give you an idea where the inconsistency comes from. What is written to the log?.
In your case the module that causes the inconsistency is MyViews. Some type may have been changed and
that type should be listed in the log.
It may be enough to recompile MyViews.

- Josef
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Consistent import

Post by Robert »

Robert wrote:I show below the import dependancies for WandsTracer itself.
This listing was generated by setting up the control Form as shown below. (Other sets of control options can produce very long lists!)
Tracer Form
Tracer Form
Tracer.png (7.37 KiB) Viewed 10772 times
Post Reply