Consistent import

Consistent import

Postby DGDanforth » Sat Feb 09, 2019 9:42 pm

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
DGDanforth
 
Posts: 1060
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA

Re: Consistent import

Postby Josef Templ » Sun Feb 10, 2019 12:37 pm

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
Josef Templ
 
Posts: 1968
Joined: Tue Sep 17, 2013 6:50 am

Re: Consistent import

Postby DGDanforth » Mon Feb 11, 2019 12:36 am

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
User avatar
DGDanforth
 
Posts: 1060
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA

Re: Consistent import

Postby cfbsoftware » Mon Feb 11, 2019 1:14 am

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.
cfbsoftware
 
Posts: 202
Joined: Wed Sep 18, 2013 10:06 pm

Re: Consistent import

Postby Josef Templ » Mon Feb 11, 2019 5:01 pm

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
Josef Templ
 
Posts: 1968
Joined: Tue Sep 17, 2013 6:50 am

Re: Consistent import

Postby DGDanforth » Tue Feb 12, 2019 2:26 am

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 544 times
User avatar
DGDanforth
 
Posts: 1060
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA

Re: Consistent import

Postby Robert » Tue Feb 12, 2019 11:47 am

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 22 times
User avatar
Robert
 
Posts: 970
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Consistent import

Postby DGDanforth » Wed Feb 13, 2019 1:40 am

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
DGDanforth
 
Posts: 1060
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA

Re: Consistent import

Postby Josef Templ » Wed Feb 13, 2019 4:42 pm

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
Josef Templ
 
Posts: 1968
Joined: Tue Sep 17, 2013 6:50 am

Re: Consistent import

Postby Robert » Thu Feb 14, 2019 12:08 pm

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.png
Tracer Form
Tracer.png (7.37 KiB) Viewed 521 times
User avatar
Robert
 
Posts: 970
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland


Return to Discussion

Who is online

Users browsing this forum: No registered users and 1 guest