- From: Achille Fokoue <achille@us.ibm.com>
- Date: Fri, 19 Mar 2004 17:52:21 -0500
- To: public-qt-comments@w3.org
- Message-ID: <OFE917E626.A24DEA11-ON85256E5C.0071D22B-85256E5C.007DA4B9@us.ibm.com>
Hi,
It seems to me that there is an inconsistency between Formal Semantics and
Functions & Operators specs on the semantics of sum().
FO spec section 15.3.5 says that any value of type untypedAtomic must be
converted into a double value, and for the one argument sum() function the
double value 0.0 must be return for an empty sequence. However, the FS
spec section 6.2.6 provides inference rules that require the conversion of
untyped atomic values into integer values, and says that sum(()) = 0
(the integer value 0) :
"The fn:sum function has two forms. The first form takes two arguments:
The first argument is the input sequence and the second argument is the
value that should be returned if input sequence is empty. In this case,
the result type is the union of the target type T and the type of the
second argument.
statEnv |- Expr1 : Type1
Type3 = convert_untypedAtomic(prime(Type1), xs:integer)
Type3 can be promoted to T
statEnv |- Expr2 : Type2 statEnv |- Type2 <:
xdt:anyAtomicType ?
--------------------------------------------------------------------------------
statEnv |- fn:sum (Expr1, Expr2) : T | Type2
The second form of fn:sum takes one argument, with an implicit second
argument of the integer value 0. In this case, the result type is the
union of target type T and xs:integer.
statEnv |- Expr1 : Type1
Type3 = convert_untypedAtomic(prime(Type1), xs:integer)
Type3 can be promoted to T
--------------------------------------------------------------------------------
statEnv |- fn:sum (Expr1) : T | xs:integer
"
Best regards,
Achille Fokoue
Received on Friday, 19 March 2004 17:52:55 UTC