[MarkLogic Dev General] dynamic module import
Ron Hitchens
ron.hitchens at marklogic.com
Thu Feb 19 10:14:22 PST 2009
No. Module imports are resolved at static analysis time,
before any code starts executing. That is when all references
are resolved and the expression tree of the request is built
(which may include code from imported modules).
XQuery is a functional language, and one of the principals
of a functional language is that there are no side effects
during execution. Dynamically loading modules would be a
whopping big side effect*.
*Yeah, we cheat a little big with xdmp:set and map:map,
but dynamically loaded modules would change *all* the rules.
On Feb 19, 2009, at 9:49 AM, Eric Palmitesta wrote:
> I'm fairly sure this isn't possible, but I might as well ask. Is
> there any way to import a particular module at runtime?
>
> I know this won't work, but it shows the idea:
>
> import module namespace blah = "http://blah" at $filename;
>
> It won't work because import statements must come before not only
> functions (and code, in the case of a main module), but before
> variable declarations as well.
>
> Can someone confirm?
>
> Thanks,
>
> Eric
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general
---
Ron Hitchens {ron.hitchens at marklogic.com} 650-655-2351
More information about the General
mailing list