[Bug 10848] [XQuery11] Statically detecting errors in try/catch and conditional expressions

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

Michael Kay <mike@saxonica.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mike@saxonica.com

--- Comment #3 from Michael Kay <mike@saxonica.com> 2010-11-02 07:14:47 UTC ---
As discussed during the meeting yesterday, I think a lot of things become
clearer if we stop talking about "detecting dynamic errors statically", but
instead talk about starting the dynamic evaluation phase before the static
evaluation phase has finished. The rules then needed include:

(a) if there are static errors, then the query must fail, even if dynamic
evaluation can complete without error (for example if the static errors are in
an imported module which is not actually needed).

(b) the processor is free to evaluate any subexpression wholly or partially as
soon as it wishes, even before the static analysis phase is complete; such
errors are propagated to the expression that is their dynamic parent/invoker in
the evaluation stack (and so on recursively), and must not be so propagated 
- if there is no invoking expression (e.g. if the subexpression is in a
function that is never called)
- if the dynamic parent expression is a conditional, typeswitch, or switch and
the error is in a branch that is not chosen
- if the dynamic parent expression is a try/catch that catches the dynamic
error

If and only if the propagation of a dynamic error reaches the base of the
evaluation stack, that is the execution of the main query body, then execution
of the query fails.

One effect of these rules is that it is possible for a dynamic error to be
propagated all the way to the base of the evaluation stack before static
analysis is complete, but only if the entire dynamic invocation ancestry of the
failing subexpression is known at that time, and does not include constructs
such as conditionals that prevent the propagation. Or to put it another way,
dynamic errors can be raised during static analysis only if they would
necessarily occur at some stage anyway, and are not conditional on information
that is not available during static analysis.

(This description relies on the concept of a dynamic evaluation stack which I
haven't tried to formalize, but which probably needs more careful exposition in
any final text.)

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 2 November 2010 07:14:50 UTC