W3C home > Mailing lists > Public > public-qt-comments@w3.org > January 2007

[Bug 4271] [FS} Type checking () op Arg

From: <bugzilla@wiggum.w3.org>
Date: Tue, 23 Jan 2007 08:44:44 +0000
CC:
To: public-qt-comments@w3.org
Message-Id: <E1H9HGm-0000ag-F9@wiggum.w3.org>

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

           Summary: [FS} Type checking () op Arg
           Product: XPath / XQuery / XSLT
           Version: Proposed Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Formal Semantics
        AssignedTo: simeon@us.ibm.com
        ReportedBy: tim@cbcl.co.uk
         QAContact: public-qt-comments@w3.org


It is unclear whether 

() op Arg

should always return () regardless of whether the operator is defined for the
type of Arg.

For an example, see XQTS test K-NumericAdd-38:

empty((1, 2) + ())

The expected result is the empty sequence.  From XQuery section 3.4:

"Each operand is evaluated by applying the following steps, in order:

1. Atomization is applied to the operand. The result of this operation is
called the atomized operand.
2. If the atomized operand is an empty sequence, the result of the arithmetic
expression is an empty sequence, and the implementation need not evaluate the
other operand or apply the operator. However, an implementation may choose to
evaluate the other operand in order to determine whether it raises an error.
3 ...

This implies that, by step 2, we can determine that the result of the
expression is the empty sequence.  We could therefore have written an
expression such as:

() + "a string"

and determined that the result is the empty sequence, even though fs:plus is
not defined on string arguments.

If this is the correct interpretation, then the typing rules in "C.2 Mapping of
Overloaded Internal Functions" should be extended to cover this case. 
Specifically, they do not cover the case of binary operators when one of the
arguments is the empty sequence and the other has a type not ordinarily
supported by that operator.
Received on Tuesday, 23 January 2007 08:44:53 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:32 UTC