[Bug 2303] typing for fn:subsequence() redundant

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

           Summary: typing for fn:subsequence() redundant
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Formal Semantics
        AssignedTo: simeon@us.ibm.com
        ReportedBy: jens.teubner@in.tum.de
         QAContact: public-qt-comments@w3.org


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.

Received on Monday, 26 September 2005 12:23:55 UTC