[Bug 11171] New: [XQuery11] dynamic errors reported during static analysis

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

           Summary: [XQuery11] dynamic errors reported during static
                    analysis
           Product: XPath / XQuery / XSLT
           Version: Member-only Editors Drafts
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 1.1
        AssignedTo: jonathan.robie@redhat.com
        ReportedBy: andrew.eisenberg@us.ibm.com
         QAContact: public-qt-comments@w3.org
             Group: XSLXQuery_WG


Section 2.3.1 Kinds of Errors says:

"Independently of whether the Static Typing Feature is in effect, if an
implementation can determine during the static analysis phase that an
expression, if evaluated, would necessarily raise a type error or a dynamic
error, the implementation may (but is not required to) report that error during
the static analysis phase. However, the fn:error() function must not be
evaluated during the static analysis phase."


Perhaps we have been to broad in saying "... during the static analysis phase
that an expression, if evaluated, would necessarily raise ...". A MainModule
usually consists of many expressions. Some of these are contained in
conditional expressions or try/catch expressions. I suggest that we should
change this to consider only the evaluation of the QueryBody. Our spec would
now say:

"Independently of whether the Static Typing Feature is in effect, if an
implementation can determine during the static analysis phase that the
evaluation of the QueryBody would necessarily raise a type error or a dynamic
error, the implementation may (but is not required to) report that error during
the static analysis phase. However, the fn:error() function must not be
evaluated during the static analysis phase."


Section 3.11 Conditional Expressions has special rules for propagating dynamic
errors:

"Conditional expressions have a special rule for propagating dynamic errors. If
the effective value of the test expression is true, the conditional expression
ignores (does not raise) any dynamic errors encountered in the else-expression.
In this case, since the else-expression can have no observable effect, it need
not be evaluated. Similarly, if the effective value of the test expression is
false, the conditional expression ignores any dynamic errors encountered in the
then-expression, and the then-expression need not be evaluated."


We should add similar wording to 3.14 Try/Catch Expressions:

"Try/catch expressions have a special rule for propagating dynamic errors. The
try/catch expression ignores any dynamic errors encountered in catch clauses
other than the first catch clause that matches an error raised by the try
clause, and these catch clause expressions need not be evaluated."


I believe that with these rules, the following query would not be allowed to
raise an error.

   declare variable $v := 1 div 0;
   declare function local:f () { 1 div 0};

   "No problem here!"

-- 
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 Friday, 29 October 2010 19:42:01 UTC