XQST0059 with cyclic module imports
Added by Anonymous about 18 years ago
Legacy ID: #3998533 Legacy Poster: marcvc (marcvc)
Michael, we're facing some issues with cyclic modules. Consider the following small repro. Consider a module in cyclic.xq: module namespace p = "cyclic"; import module "cyclic" at "cyclic.xq"; declare function p:foo() {1 + 2}; Executing the following query: import module namespace p = "cyclic" at "cyclic.xq"; p:foo() Results in: XQST0059: Cannot locate module for namespace cyclic Remove the cyclic import from cyclic.xq and the query works. Ok, it's weird to import yourself, but that's just to reprodcue the issue. We have the same error being reported with multiple cyclic modules (in the same namespace). Thanks, Marc
Replies (1)
RE: XQST0059 with cyclic module imports - Added by Anonymous about 18 years ago
Legacy ID: #4000376 Legacy Poster: Michael Kay (mhkay)
It's not clear to me why you would expect this to work. It's failing for a fairly random reason and could be made cleaner, but I think it should fail. I think it should probably fail under the rule "It is a static error if the expanded QName and arity of a function declared in an imported module are respectively equal to the expanded QName and arity of a function declared in the importing module or in another imported module (even if the declarations are consistent) [err:XQST0034]. ") As far as I can see, cases that ought to work do, for example: main.xq import module namespace p = "cyclic" at "cyclic.xq"; p:foo() cyclic.xq module namespace p = "cyclic"; import module "cyclic" at "cyclic1.xq"; declare function p:foo() {1 + p:bar()}; declare function p:baz() {17}; cyclic1.xq module namespace p = "cyclic"; import module "cyclic" at "cyclic.xq"; declare function p:bar() {1 + p:baz()}; Incidentally, the XQuery WG is considering making some last-minute changes in this area because the formal semantics covering module imports is broken. I guess under a strict reading of the rules it's legal for a module to import itself if it contains no variables or functions, but that case is so pointless I think I will still let it fail under the rule that the interpretation of the location URI is implementation-defined.
Please register to reply