[Bug 5224] [XQuery] Dynamic context in global variable initializers

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





------- Comment #9 from jmdyck@ibiblio.org  2008-02-29 22:37 -------
(In reply to comment #8)
> 
> In http://www.w3.org/TR/xquery/#id-dynamic-evaluation:
> 
> <old>
> [Definition: The dynamic evaluation phase is the phase during which the value
> of an expression is computed.] It occurs after completion of the static
> analysis phase.
> </old>
> 
> <new>
> [Definition: The dynamic evaluation phase is the phase during which the value
> of an expression is computed.] It occurs after completion of the static
> analysis phase and after the initial dynamic context has been created. The
> dynamic evaluation phase includes evaluation of the prolog, followed by
> evaluation of the query body.
> </new>

Upon reflection, I'd be inclined to say that creation of the initial dynamic
context occurs *within* the dynamic evaluation phase, rather than before it.
Note that step DQ3, in which the dynamic context "draws information from the
external environment" is apparently part of the dynamic evaluation phase, and
that (for comparison) the static environment is initialized as part of the
static analysis phase. 

Thus, rather than replacing the existing <old> text we could just add the
following sentence to it: 
    The dynamic evaluation phase includes creation of the
    initial dynamic context, followed by evaluation of
    the prolog, followed by evaluation of the query body.


> In http://www.w3.org/TR/xquery/#id-variable-declarations
> 
> After "The static context for an initializing expression includes all functions
> that are declared or imported anywhere in the Prolog, but it includes only
> those variables and namespaces that are declared or imported earlier in the
> Prolog than the variable that is being initialized." 
> 
> Add "The dynamic context for an initializing expression is the same as the
> dynamic context for the QueryBody in the main module, except that Variable
> Values and Function Implementations are populated only for those variables and
> functions that are within the static context of the expression".

This is incorrect. For an initializing expression X in a library module L, the
dynamic context of the QueryBody doesn't even necessarily *have* definitions
for the variables and functions in the static context of X. And, where it does,
those definitions may differ from the ones established by the prolog of L.

Perhaps it would suffice to note that, in the dynamic context for an
initializing expression, the focus is the same as that of the initial dynamic
context of the module containing the initializing expression.

Received on Friday, 29 February 2008 22:37:08 UTC