<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>4939</bug_id>
          
          <creation_ts>2007-08-09 16:34:39 +0000</creation_ts>
          <short_desc>[FO] Specify both &quot;fn:f(a as t?) as r?&quot; and &quot;fn:f(a as t) as r&quot;</short_desc>
          <delta_ts>2009-10-12 22:28:48 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>Functions and Operators 3.0</component>
          <version>Recommendation</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc>http://www.w3.org/TR/xquery-operators/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P4</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ben Wagner">bungeman</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          <cc>holstege</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>16106</commentid>
    <comment_count>0</comment_count>
    <who name="Ben Wagner">bungeman</who>
    <bug_when>2007-08-09 16:34:39 +0000</bug_when>
    <thetext>There are a large number of functions specified of the form like, for example, (http://www.w3.org/TR/xquery-operators/#func-years-from-duration)

fn:years-from-duration($arg as xs:duration?) as xs:integer?

which only return the empty sequence if the argument is the empty sequence. For static type checking purposes, it is often convenient to be able to specify that the type of an expression not contain the empty sequence, but this becomes difficult to reason about when so many functions may be returning empty sequence. It would be helpful if there were also function specifications of the form 

fn:years-from-duration($arg as xs:duration) as xs:integer

with the additional static rule of choosing the most specific form (since this is obviously overloading the function name). There may be other ways of addressing this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16118</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2007-08-09 22:11:14 +0000</bug_when>
    <thetext>Personal (and interim) response:

(a) extra rules for static type checking belong in the formal semantics document, not in the F+O specification.

(b) I think we relaxed the static typing rules sufficiently to allow products to make type inferences beyond those that we list in the FS specification. There&apos;s vast scope for this, and I think that encoding everything that one can deduce about the return type within the signature would not be possible or helpful. It&apos;s true that there are some common patterns - such as &quot;if arg0 is empty then result is empty&quot; or &quot;result is of the same type as arg0&quot;, but there are also many more subtle variations, especially if your static analysis is interested in static properties other than the type, which seems rather likely in a real product, but is well outside the scope of the specification.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16465</commentid>
    <comment_count>2</comment_count>
    <who name="Frans Englich">frans.englich</who>
    <bug_when>2007-09-11 14:37:08 +0000</bug_when>
    <thetext>#1 sounds sensible to me.

I believe such inferences can be implemented as static typing extensions, see 5.2.3.1 Static Typing Extensions in the XQuery spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19483</commentid>
    <comment_count>3</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2008-03-14 20:41:17 +0000</bug_when>
    <thetext>Recategorized as 1.1 feature request</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23915</commentid>
    <comment_count>4</comment_count>
    <who name="Mary Holstege">holstege</who>
    <bug_when>2009-02-24 21:39:09 +0000</bug_when>
    <thetext>The WG considered this bug 2009-02-24 and agreed with the gist of comment #1,
that static extensions can take care of this issue. The bug is therefore being closed with no action.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28283</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2009-10-12 22:28:48 +0000</bug_when>
    <thetext>Since we informed the originator that this was being closed with no action and there has been no push-back, I am marking this closed. Please feel free to reopen it if you are not satisfied with this outcome.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>