This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 2303 - typing for fn:subsequence() redundant
Summary: typing for fn:subsequence() redundant
Status: CLOSED DUPLICATE of bug 1728
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Formal Semantics 1.0 (show other bugs)
Version: Last Call drafts
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Jerome Simeon
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-26 12:23 UTC by Jens Teubner
Modified: 2005-09-29 11:01 UTC (History)
0 users

See Also:


Attachments

Description Jens Teubner 2005-09-26 12:23:01 UTC
The static typing rules for fn:subsequence() (http://www.w3.org/TR/2005/WD-
xquery-semantics-20050915/#sec_fn_subsequence) consider a number of special 
cases:

  fn:subsequence (Expr, 1, 1)
  fn:subsequence (Expr, $fs:last, 1)
  fn:subsequence (Expr, $fs:position, 1)

All of them result in the same static type, prime(Expr)?. This is not 
surprising, as the second function argument is actually completely irrelevant 
for the function's output type. The call

  fs:subsequence (Expr, 42, 1)

would as well have the same static type, prime(Expr)?. (You may add that to the 
typing rules as well :-))

Note that, as I stated in http://www.w3.org/Bugs/Public/show_bug.cgi?id=1968, it 
is hardly sensible to use $fs:last and/or $fs:position here anyway. Both 
variables are not necessarily related to Expr, but should be treated like any 
other variable here.
Comment 1 Jerome Simeon 2005-09-28 10:18:13 UTC
Jens,

This issue has already been discussed in the previous last call period. The
reason for having specific typing rules only for those cases is that they cover
exactly
the cases that correspond to the normalized expressions for Expr[1] and
Expr[last()].

This was already discussed as part of Bug #1728
(http://www.w3.org/Bugs/Public/show_bug.cgi?id=1728)
Notably see Michael Rys's comment #2 in that Bug.

Best regards,
- Jerome
On behalf of the XSLT and XML Query WGs

*** This bug has been marked as a duplicate of 1728 ***
Comment 2 Jerome Simeon 2005-09-29 09:16:43 UTC
While processing this comment, the working group realized that the first of the
three rules related to this comment had a bug. The intent is to have
Expr[Numeric] be given a more specific type, not only Expr[1]. The rule should
be revised to
the following:

statEnv |-  QName of func expands to (FN-URI,"subsequence")
statEnv |-  Expr : Type      quantifier(Type) in { * }
-----------------------------------------------------------
statEnv  |-  QName(Expr, Numeric, 1) : prime(Type) ?

Thanks again for your comment on our specifications,
- Jerome
One behalf of the XML Query and XSLT WGs