RE: MS-FO-LC1-016: Handling of () with operators

The formal semantics has this hidden in one of its dynamic semantics
sections.

 

I got lots of feedback from my implementers, that the current arithmetic
rules are almost impossible to understand since they are distributed
across 3 documents and about 5 sections. Especially the behaviour if you
have an expression that provides a union type during static analysis is
not clear with the current specs. What should happen to xs:integer |
xs:double + xs:float | xdt:untypedAtomic for example? People normally
get lost somewhere in the normalization rules....

 

As to the empty sequence handling, we need to have at least a reference
to the section that defines the semantics of ()+4.

 

Best regards

Michael

 

PS:  Here is my understanding of the example:

 xs:integer | xs:double + xs:float | xdt:untypedAtomic due to promotion
of untyped to double (and have integer and float promoted to double) and
due to the runtime dispatch semantics that would propagate an integer to
a float only if you add integer and float, the static result type is
xs:float | xs:double. The dynamic (optimized) semantics for $a + $b with
the above static type is (using procedural pseudo-code):

 

if $b instance of xdt:untypedAtomic then let $b := $b cast as xs:double;

if $a instance of xs:integer and $b instance of xs:float then return
op:float-add($a cast as xs:float, $b);

if $a instance of xs:integer and $b instance of xs:double then return
op:double-add($a cast as xs:double, $b);

if $a instance of xs:double and $b instance of xs:double then return
op:double-add($a, $b);

if $a instance of xs:double and $b instance of xs:float then return
op:double-add($a, $b cast as xs:double);

 

 

-----Original Message-----
From: public-qt-comments-request@w3.org
[mailto:public-qt-comments-request@w3.org] On Behalf Of Ashok Malhotra
Sent: Wednesday, July 30, 2003 5:46 AM
To: Michael Rys; public-qt-comments@w3.org
Subject: RE: MS-FO-LC1-016: Handling of () with operators

 

Michael:

Thank you for your comment.  I have looked at the op: functions in
section 6.2 and elsewhere and the semantics do not describe

behavior if the functions are passed ().  I will double check.

All the best, Ashok 

________________________________

From: public-qt-comments-request@w3.org
[mailto:public-qt-comments-request@w3.org] On Behalf Of Michael Rys
Sent: Monday, June 30, 2003 3:54 PM To: public-qt-comments@w3.org
Subject: MS-FO-LC1-016: Handling of () with operators

 

Class: Editorial      
 
section 6.2 and others: The operator function signatures do not allow
(), however the actual operators accept (). This mismatch leads to
confusion and should be solved by either adding the semantics for () or
by some other form of consolidation.

Received on Wednesday, 30 July 2003 13:11:38 UTC