[Bug 4418] [XQuery] cyclic module imports

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

           Summary: [XQuery] cyclic module imports
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


At a late stage in the development of XQuery 1.0 (in fact, at the PR stage) a
new rule was introduced (see 4.11):

It is a static error [err:XQST0093] to import a module M1 if there exists a
sequence of modules M1 ... Mi ... M1 such that each module directly depends on
the next module in the sequence

The definition of "directly depends" means that a dependency only exists if the
importing module actually uses a variable or function in the imported module.

The published spec also retains the older rule (also in 4.11): 

A module may import its own target namespace (this is interpreted as importing
an implementation-defined set of other modules that share its target
namespace.) However, it is a static error [err:XQST0073] if the graph of module
imports contains a cycle (that is, if there exists a sequence of modules M1 ...
Mn such that each Mi imports Mi+1 and Mn imports M1), unless all the modules in
the cycle share a common namespace.

The cumulative effect of these rules is that a cycle of imports is permitted in
one case only: where two modules share the same namespace but where at least
one of the imports is redundant, that is, a module imports another but does not
reference anything in the imported module.

It seems unnecessarily onerous on implementations, and unhelpful to users, to
permit cyclic imports in one situation only, that being a situation where it
achieves nothing. I would propose banning all cyclic imports in XQuery 1.0, and
removing all restrictions in XQuery 1.1.

(In Saxon, incidentally, I currently enforce the restrictions as described in
the Rec, but because previous versions of both the product and the spec were
more liberal I have a user option to remove all restrictions on cyclic imports
and forwards references. There is no conceptual difficulty in doing this; the
limitations were introduced at the last minute only because of bugs in the
formal semantics.)

Received on Wednesday, 28 March 2007 10:29:00 UTC