[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: limits of the generic


jeff greif
Jeni,

I think you've hit the nub of this issue.  We expect '+' to be commutative,
associative, and have additive inverses.  At least associativity and
additive inverses have been shown in the examples in this thread to have
been violated when dates and one or more durations are added.  We also
expect consequences of these properties, such as
    a + x = a + y   => x = y
    x < y => x + a < y + a
(where a is a duration and x and y are dates) to be true, and they are not
(the converse of the first one is true, however).  The algebra of DateTime x
Duration with operation + is not the algebra of a group or any other
familiar structure, so many of our expectations for the '+' operation will
be violated.  Typically this is occuring because a thing that looks like a
fixed duration, such as P1M, is actually a different length in units of days
or seconds depending upon the context in which it is used in addition.

As you say, however, it is useful to be able to add and subtract dates and
durations.  If someone with a decent background in algebra can spell it out
formally, there may be some way for people to use '+' and not have their
intuition violated too often.  Otherwise, (or perhaps even if there is a
formal algebra, but it's too exotic) treating the addition as a named
function with arbitrary but reasonable semantics, without all the
assumptions about '+' that we drag into every addition we see, may be the
right way to proceed.

Jeff
----- Original Message -----
From: "Jeni Tennison" <jeni@j...>
To: "Jeff Greif" <jgreif@a...>
Cc: <xml-dev@l...>
Sent: Monday, September 30, 2002 4:27 AM
Subject: Re:  limits of the generic


> Hi Jeff,
...
>
> Hmm... The thing is that adding durations to date/times is a useful
> thing to do, so I'd be loath to make it impossible in XPath 2.0. If it
> were done through a function call instead, that would enable the +
> operator to retain its usual semantics. What do you think? Would it
> matter if:
>
>   2002-01-28  <  2002-01-30
>
> but not:
>
>   add-yearMonthDuration-to-date(
>     xs:date('2002-01-28'), xs:yearMonthDuration('P1M')) <
>   add-yearMonthDuration-to-date(
>     xs:date('2002-01-30'), xs:yearMonthDuration('P1M'))
>



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.