John Reimer wrote:
Hello Derek,
Just thinking out aloud ...

If two modules import each other and this can be 'fixed' by instead
having both modules as a single module, what is stopping the compiler
from just pretending that they are a single module for compilation
purposes?

This does assume that they are to be compiled at the same time rather
than one-file-at-a-time.



Interesting idea. :)

Maybe there would be issues with module ctors and __FILE__/__LINE__ expressions too?
Also it may mess up module info, debug, and other object attributes.

-JJR

This would work with two modules.

How would it work with more than that? You'd have to come up with a complete import graph (which you already need, I assume), search it for cycles, then, for each cycle, resolve it by combining static constructors.

It should work.

Reply via email to