You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For nested modules, the parent module and its uses are initialized before the nested module and its uses or imports.
to indicate a constraint that requires parent modules are always initialized first, but this is not the case.
I think that what is actually happening is that Main starts initialization first, but the initialization process for Main causes Main.Submodule to be initialized.
The language specification is close to describing this in
Starting from the module that defines the main procedure, the modules named in its use and import statements are visited depth-first and initialized in post-order. If a use or import statement names a module that has already been visited, it is not visited a second time. Thus, infinite recursion is avoided.
Maybe this is clear enough? I think it's a bit subtle to interpret the "visited depth-first" as a separate operation from being initialized in post-order.
What to do about this?
add an example
clarify the "parent modules initialized first" part to indicate parent modules begin initialization first
while there, clarify that an except clause does not count as "naming" a module
The text was updated successfully, but these errors were encountered:
mppf
changed the title
[Documentation]: Module Initialization Order spec section is not clear about used submodules
[Documentation]: Module Initialization Order spec section could be clearer about submodules
May 3, 2024
Consider this program:
At present, compiling and running this program produces this output:
However, the language specification's description of module initialization order could be clearer about this being the result. One might interpret the statement
to indicate a constraint that requires parent modules are always initialized first, but this is not the case.
I think that what is actually happening is that Main starts initialization first, but the initialization process for
Main
causesMain.Submodule
to be initialized.The language specification is close to describing this in
Maybe this is clear enough? I think it's a bit subtle to interpret the "visited depth-first" as a separate operation from being initialized in post-order.
What to do about this?
except
clause does not count as "naming" a moduleThe text was updated successfully, but these errors were encountered: