- From: <bugzilla@wiggum.w3.org>
- Date: Tue, 13 Nov 2007 23:46:12 +0000
- To: public-qt-comments@w3.org
- CC:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=4841 ------- Comment #17 from jmdyck@ibiblio.org 2007-11-13 23:46 ------- As directed by action item A-346-02, here is the consolidation of my proposal from Comment #10 with the amendments of Comment #11 (#13) and most of Comment #12 (#15), plus some minor editorial tweaks. (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 mod 1 eq 0) then fn:subsequence($sourceSeq,$loc,1) else () }; Static Type Analysis The static typing rules for invocations of fs:item-at depend on the syntactic form of the second argument. If it is the IntegerLiteral 1, then we can be relatively precise about the resulting type. statEnv |- QName of func expands to (FS-URI,"item-at") statEnv |- Expr1 : Type1 quantifier(Type1) in { 1, + } -------------------------------------------------------- statEnv |- QName(Expr1, 1) : prime(Type1) Otherwise, the following less precise rule is used. statEnv |- QName of func expands to (FS-URI,"item-at") statEnv |- Expr1 : Type1 -------------------------------------------------------- statEnv |- QName(Expr1, Expr2) : prime(Type1) ? (Since invocations of fs:item-at arise only as the result of particular normalization rules, Expr2 in the above rule must be either $fs:last, $fs:position, or a NumericLiteral. Thus, there is no need to check its type.) (C) In "7.2.13 The fn:subsequence function": Introduction: Drop it. Static Type Analysis: Drop everything except the last rule (the catch-all case). Change the last rule's preceding prose to: The static type of a call to 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, 13 November 2007 23:46:30 UTC