- From: <bugzilla@wiggum.w3.org>
- Date: Sun, 10 Jul 2005 22:10:31 +0000
- To: public-qt-comments@w3.org
- Cc:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=1523 mike@saxonica.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|WONTFIX | ------- Additional Comments From mike@saxonica.com 2005-07-10 22:10 ------- I think this is a case (there are many others in F+O) where the spec is trying to be too helpful, and where it doesn't distinguish clearly enough between rules and helpful remarks about the consequences of the rules. I think the sentence "If $startingLoc is zero or negative, the subsequence includes items from the beginning of the $sourceSeq." falls into the "helpful remark" category. It's an incomplete statement. Both the suggested answers (1,2,3,4) and (1) in fact have the property that the result includes items from the start of the input sequence, so this sentence doesn't help to decide which of these answers is right. There are other cases (for example subsequence((1,2), -10, 0) where the sentence is false - in this case the result doesn't include any items from the start of the input sequence. Personally, I would structure the specification of this function as: <quote> SUMMARY: Returns the contiguous sequence of items in the value of $sourceSeq beginning at the position indicated by the value of $startingLoc and continuing for the number of items indicated by the value of $length. RULES: In the two-argument case, returns the items in $sourceSeq whose position $p obeys: fn:round($startingLoc) le $p In the three-argument case, returns the items in $sourceSeq whose position $p obeys: fn:round($startingLoc) le $p and $p lt fn:round($startingLoc) + fn:round($length) NOTES If $sourceSeq is the empty sequence, the empty sequence is returned. If $startingLoc is zero or negative, the subsequence includes items from the beginning of the $sourceSeq. If $length is not specified, the subsequence includes items to the end of $sourceSeq. If $length is greater than the number of items in the value of $sourceSeq following $startingLoc, the subsequence includes items to the end of $sourceSeq. The first item of a sequence is located at position 1, not position 0. For detailed type semantics, see Section 7.2.11 The fn:subsequence functionFS </quote> Specifying it this way deals unambiguously and economically with awkward corner cases such as a position or length of infinity or NaN. (Note also, the current text has an incorrect reference to $sourceString)
Received on Sunday, 10 July 2005 22:10:35 UTC