W3C home > Mailing lists > Public > public-qt-comments@w3.org > February 2006

[Bug 2789] Substitutability of duration subtypes

From: <bugzilla@wiggum.w3.org>
Date: Wed, 01 Feb 2006 13:53:41 +0000
To: public-qt-comments@w3.org
Cc:
Message-Id: <E1F4IQX-0005jw-KZ@wiggum.w3.org>

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





------- Additional Comments From frans.englich@telia.com  2006-02-01 13:53 -------
   
I thought some more about it, and the current situation is a bit of a can of   
worms, I'd say. Consider the following expression:   
   
xs:duration(xdt:dayTimeDuration("P365D"))   
       eq   
xs:duration(xdt:yearMonthDuration("P1Y"))   
   
   
>From what I can tell, the validity of this expression depends on whether the   
dynamic types(xdt:dayTimeDuration/xdt:yearMonthDuration) or the static   
types(xs:duration/xs:duration) are used for the operator lookup. Perhaps,  
behavior could in practice become implementation dependent, considering the  
freedom implementations have in handling the types of values(subtype  
substitution, for example). The essence seems to be that in the case of the  
duration operators one can't rely on the very primitive base type(which  
one can in all other cases), but that a sub-type/dynamic type might be of  
importance. But yes, the solution Michael proposed seems to solve all this.  
  
Also, the pseudo function in op:duration-equal can be simplified into:   
   
return cast as xdt:yearMonthDuration($arg1) eq   
       cast as xdt:yearMonthDuration($arg2)    
                and   
       cast as xdt:dayTimeDuration($arg1) eq    
       cast as xdt:dayTimeDuration($arg2)  
  
It is less code(the if-expression was removed), but, of course, that doesn't  
necessarily mean readability is improved.  
   
  
Frans
Received on Wednesday, 1 February 2006 13:53:50 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:10 UTC