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

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





------- Comment #32 from jmdyck@ibiblio.org  2006-11-02 20:58 -------
(In reply to comment #29)
>
> Changes to XQuery 1.0 book
> ...
> If a module depends on itself by any combination of transitive
> dependencies, a static error is raised.

Is this in addition to, or instead of, the current "graph of module imports
contains a cycle" error? Because there are some cases that are errors according
to the current rule that are not errors according to the proposed rule.

One trivial example is
    ----
    module        namespace A = "http://www.example.com/A";
    import module namespace B = "http://www.example.com/B";
    declare variable $A:a = 'a';
    ----
    module        namespace B = "http://www.example.com/B";
    import module namespace A = "http://www.example.com/A";
    declare variable $B:b = 'b';
    ----
There's certainly a cycle in the graph of module imports (and so, an error for
the current rule), but because neither module references any of the other's
variables or functions, neither "depends on" the other, so the proposed rule
raises no error.

Less trivial:
    --------
    module        namespace S1 = "http://www.example.com/siblings";
    declare variable $S1:s1 = 's1';
    --------
    module        namespace X = "http://www.example.com/x";
    import module namespace S = "http://www.example.com/siblings";
    declare variable $X:x1 = $S:s1;
    declare variable $X:x2 = 'x2';
    --------
    module        namespace S2 = "http://www.example.com/siblings";
    import module namespace X  = "http://www.example.com/x";
    declare variable $S2:s2 = $X:x2;
    --------
Module X imports the 'siblings' namespace, and thereby the modules S1 and S2;
S2 imports the 'x' namespace and thereby the module X; thus there is a cycle in
the import graph (X -> S2 -> X) and the current rule raises an error. However,
in the "depends on" graph, we merely have S2 depends on X (because of $x2) and
X depends on S1 (because of $s1); there's no cycle, so the proposed rule does
not raise an error.

Received on Thursday, 2 November 2006 20:59:21 UTC