duplicate declaration error-message when using dynamic module-imports ( inspect:functions)
Tuesday, 8 September 2015 · 2 messages · last reply 16 Sep 2015
RS
Rob Stapper8 Sep 2015 16:16 #
Hi,
I get a "duplicate declaration" error-message when I using the inspect:functions-function.
Consider program: testRun1-2a.xq. The program imports module: module1.xqm and module2a.xqm.
Module: module1.xqm, declares a variable: $mod1:x, and a function:
mod1:show( $x).
Module: module2a.xqm, declare a function: mod2a:run, which calls a function
by a given function-name: $name in a dynamically imported module by a given
module-uri: $uri.Program: testRun1-2a.xq, calls the run-function in module2a and tells it to use variable: $mod1:x, on function: mod1:show in module: module1.xqm.
This triggers an error: Duplicate declaration on static variable $mod1:x.
On the other hand, program: testRun1-2b.xq, does exactly the same except that module:module2b.xqm, is statically linked to module: module1.xqm, instead of dynamically as happens in module:module2a.xqm.
Shouldn't the dynamically import of modules behave in the same manner as its static counterpart?
Is it possible to achieve this?
Cheers,
Rob
PS the examples are a bit awkward but in my real-life program this construction makes sense (to my anyway).
---
Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. https://www.avast.com/antivirus
CG
Christian Grün16 Sep 2015 13:07 #
Hi Rob,
I have added a new GitHub issue for your test case [1]. You may already have noticed in the past that there is no well-defined semantics of the inspect functions. Things may get easier once we've implemented the new load-xquery-module function [2].
Best,
Christian
PS: Btw, please always try to send us examples that work out of the box ;)
[1] https://github.com/BaseXdb/basex/issues/1194
[2] http://www.w3.org/TR/xpath-functions-31/#func-load-xquery-module
Quoted text · Rob Stapper · 48 lines
On Tue, Sep 8, 2015 at 4:16 PM, Rob Stapper <r.stapper at lijbrandt.nl> wrote: > > Hi, > > > > I get a “duplicate declaration” error-message when I using the inspect:functions-function. > > > > Consider program: testRun1-2a.xq. The program imports module: module1.xqm and module2a.xqm. > > Module: module1.xqm, declares a variable: $mod1:x, and a function: mod1:show( $x). > > Module: module2a.xqm, declare a function: mod2a:run, which calls a function by a given function-name: $name in a dynamically imported module by a given module-uri: $uri. > > Program: testRun1-2a.xq, calls the run-function in module2a and tells it to use variable: $mod1:x, on function: mod1:show in module: module1.xqm. > > This triggers an error: Duplicate declaration on static variable $mod1:x. > > > > On the other hand, program: testRun1-2b.xq, does exactly the same except that module:module2b.xqm, is statically linked to module: module1.xqm, instead of dynamically as happens in module:module2a.xqm. > > > > Shouldn’t the dynamically import of modules behave in the same manner as its static counterpart? > > Is it possible to achieve this? > > > > Cheers, > > Rob > > > > PS the examples are a bit awkward but in my real-life program this construction makes sense (to my anyway). > > > > ________________________________ > > Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. > www.avast.com > >
Written for BaseX 8.2. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery