- From: <bugzilla@wiggum.w3.org>
- Date: Tue, 30 Oct 2007 04:31:16 +0000
- To: public-qt-comments@w3.org
- CC:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=4841
------- Comment #10 from jmdyck@ibiblio.org 2007-10-30 04:31 -------
At meeting 337, I was directed to propose a solution that did not change the
results of static type analysis. This excludes all of the above suggestions
except #2 in Comment #5. Here is a more fleshed-out version of that solution.
(A)
At every occurrence of "fn:subsequence" in 4.2.1 and 4.3.2:
-- Change "fn:subsequence" to "fs:item-at".
-- Delete the third argument (always "1").
(B)
Create a new section:
7.1.13 The fs:item-at function
fs:item-at($sourceSeq as item()*, $loc as xs:double) as item()?
The fs:item-at function returns the item at a specified position in
a sequence.
Dynamic Evaluation
If $loc is numeric-equal to the position of some item in $sourceSeq,
that item is returned. (This implies that $sourceSeq is non-empty,
and $loc is numeric-equal to an integer between 1 and n inclusive,
where n is the number of items in $sourceSeq.)
Otherwise, the empty sequence is returned.
The function is roughly equivalent to the following user-defined
function.
declare function fs:item-at(
$sourceSeq as item()*,
$loc as xs:double) as item()?
{
if ($loc div 1 eq 0) then
fn:subsequence($sourceSeq,$loc,1)
else
()
};
Static Type Analysis
The static typing rules for invocations of fn:item-at depend on the
syntactic form of the second argument. By construction, this must
be either $fs:last, $fs:position, or a NumericLiteral. Thus, those
are the only cases considered by the following rules.
[Then, from 7.2.13 / STA, move all but the last rule (and its
preceding prose) to here, with the following changes:
'fn:subsequence' --> 'fs:item-at'
(FN-URI,"subsequence") --> '(FS-URI,"item-at")'
In each rule's conclusion, drop the function call's third arg
(always "1").
]
(C)
In "7.2.13 The fn:subsequence function":
Introduction:
Drop it.
Static Type Analysis:
Everything except the last rule (the catch-all case) has been moved
to 7.1.13.
Change the last rule's preceding prose to:
The static type for the fn:subsequence is computed using prime
and quantifier, which are defined in [8.4 Judgments for FLWOR
and other expressions on sequences].
(D)
In "C.1 Functions and Operators used in the Formal Semantics", drop the
list item for fn:subsequence.
Received on Tuesday, 30 October 2007 04:31:25 UTC