[Bug 1708] New: [FS] (editorial) recommendation for static typing extensions

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

           Summary: [FS] (editorial) recommendation for static typing
                    extensions
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P4
         Component: Formal Semantics
        AssignedTo: simeon@us.ibm.com
        ReportedBy: dflorescu@mac.com
         QAContact: public-qt-comments@w3.org


In 6.1 Static Typing Extensions, the FS specification states the following:

"It is not recommended for a static typing extension to change the
static typing behavior of expressions that specify a type explicitely
 (treat as, cast as, typeswitch, function parameters, and type
declarations in variable bindings), since the purpose of those 
expressions is to impose a specific type."

This kind of recommendation is not appropriate for a standard specification.
In fact, many desirable static typing extensions will violate this recommendation.
This is likely to happen if the specified type is a supertype of the static type result. 

Consider the following example:

declare function local:f($x as xs:decimal) as item* {$x};
local:f(3)+4

The static type analysis can infer that the function retun type is
xs:decimal, which is more specific than item*. So an implementation 
may correctly infer xs:decimal as the static type of local:f() 
such that that the subsequent static type analysis of addition will be OK. 
Otherwise, this query will  unnecessarily yield pessimestic type errors.

Received on Monday, 18 July 2005 07:22:34 UTC