[Bug 23435] New: It's not possible to add two 'duration's without knowing an end point

https://www.w3.org/Bugs/Public/show_bug.cgi?id=23435

            Bug ID: 23435
           Summary: It's not possible to add two 'duration's without
                    knowing an end point
           Product: XML Schema
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Datatypes: XSD Part 2
          Assignee: David_E3@VERIFONE.com
          Reporter: me@jspha.com
        QA Contact: www-xml-schema-comments@w3.org
                CC: cmsmcq@blackmesatech.com

In brief: it's not possible to add two durations and get a third one, at least
not without knowing one end point of the duration. For instance, if we try to
add them as a "cartesian product"

    d1      =   (3 months) * (10 seconds)
    d2      = - (2 months) * (11 seconds)
    d1 + d2 =   (1 month)  * (-1 seconds)

where the result is invalid. It might be possible to meaningfully "add" it to a
'dateTime' by first moving forward a month and then back a second, but it
cannot be printed.

We could try to rectify this by assuming a month is 30*24*60*60 = 2,592,000
seconds and borrowing so that

    d1 + d2 =   (0 months) * (2,591,999 seconds)

but obviously the assumption that our 1 month has exactly 30 days is bad.


The driver for this "bug" is somewhat extracurricular in that I would like to
have additive group semantics on 'duration's which is not actually mandated by
the standard. I'd imagine that many people treat 'duration's as being additive
already, actually, so this could cause a subtle bug.

The real clincher however would be to be able to treat 'duration's as the
additive group underlying 'dateTime's as an affine space. This provides great
semantics such as, for any three 'dateTime's 'dt1', 'dt2', 'dt3' we could have

    dt2 - dt1 = dur21
    dt3 - dt1 = dur31
    dt3 - dt2 = dur32

    dur21 + dur32 = dur31

where 'durXX' are all 'duration's.



One potential fix for this would be to remove the restriction that ensures the
polarity of the months and the seconds components of a duration are the same.
This would enable the "cartesian product" additive group definition. It would
require (at least) an extension to the lexical space to include the distinction
between "globally negative values", "month negative values", and "second
negative values".

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 3 October 2013 21:22:57 UTC