[Bug 1705] [FS] technical: 5.2 Module Declaration: cyclical imports

http://www.w3.org/Bugs/Public/show_bug.cgi?id=1705





------- Comment #36 from jmdyck@ibiblio.org  2006-11-03 00:05 -------
You can break the M-N-L cycle by adding to 5.11 the "AnyURI0 != AnyURI1" etc.
machinery from Comment #23. But then you have the problem I raised in Comment
#28: the presence or absence of a self-import in a module has no effect on the
statEnv that its expressions "see". However, I think you can fix that...

You say "There should be some changes to the =>stat judgment so that it passes
only the relevant part of the static environment between modules." One way to
do this would be to remix some more stuff from Comment #28. Make the =>stat
judgment be:

    statEnv_N_in ; statEnv_E_in ; AnyURI |- PrologDeclList_in
    =>stat
    statEnv_N_out ; statEnv_E_out with PrologDeclList_out

statEnv_N is the "normal" statEnv, used for all the usual purposes.

statEnv_E is the "export" statEnv, containing (conceptually) the funcType and
varType of the current module's "siblings". (In reality, it doesn't contain
entries for *all* the functions and variables of a module's siblings, but it
does contain all the ones that the module depends on, which is what matters.)

The big =>module_statEnv rule in 5.2 would say:

    ...
    statEnvDefault |- PrologDecls gather function signatures statEnv_E_0
    statEnvDefault ; statEnv_E_0 ; AnyURI |- ...1
        =>stat
        statEnv_1 ; statEnv_E_1 with PrologDeclList1'
    ...
    statEnvDefault ; statEnv_E_[n-1] ; AnyURI |- ...n
        =>stat
        statEnv_n ; statEnv_E_n with PrologDeclListn'
    --------
    AnyURI =>module_statEnv statEnvn_E_n

(Note that all modules start out with just statEnvDefault as their "normal"
statEnv.)

So that would take care of initializing the export-env and propagating it
between sibling modules (and propagating it out to whatever called
=>module_statEnv). =>stat would only update it for var decls (also updating the
normal statEnv), and would only consult it for self-imports ("AnyURI0 =
AnyURI1"), copying its var + func info into statEnv_N_out.

Received on Friday, 3 November 2006 06:00:56 UTC