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

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

Michael Dyck <jmdyck@ibiblio.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdyck@ibiblio.org

--- Comment #1 from Michael Dyck <jmdyck@ibiblio.org> 2010-09-30 17:36:12 UTC ---
(In reply to comment #0)
> Section 3.14 states (for try/catch expressions):
> 
> If an error found in a try clause can be detected statically, an
> implementation is free to raise a static error.

That's poorly worded.
-- "detected statically" should probably be "detected during the static
analysis phase".
-- "is free to" could be just "may".
-- If a dynamic (or type) error is detected + raised during static analysis, it
doesn't thereby become a static error.

We could come up with a better wording, but I think it would just be a
reiteration of the (8th) paragraph in section 2.3.1 "Kinds of Errors"
about reporting non-static errors during static analysis.

> This means that the following query:
> 
> if ($test)
> then (1 div 0)
> else false()
> 
> is not allowed to raise the error until runtime (as it is a dynamic error)

I disagree, I believe it can raise an error during static analysis. 
(Specifically, because the expression "1 div 0", if evaluated, would
necessarily raise err:FOAR0001, an implementation may (but need not) report
that error during static analysis.)

That is, the IfExpr-specific rules about not raising errors only refer to what
is allowed during dyanmic evaluation, and don't override the general rule about
raising non-static errors during static analysis.

> but
> 
> if ($test)
> then try {1 div 0 } catch * { true() }
> else false()
> 
> is allowed to raise a division by zero error statically,

Yes.

> as it is raised as a static error.

No, it's still a dynamic error.


> 1. Always allow the error to be raised.  This requires a change to the text of
> IfExpr, TypeswitchExpr and SwitchExpr to state that dynamic errors detected
> statically may be raised.

I think we just need to clarify that special rules about propagation of dynamic
errors are only talking about what happens during dynamic evaluation.

-- 
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 Thursday, 30 September 2010 17:36:14 UTC