<?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>3842</bug_id>
          
          <creation_ts>2006-10-17 07:41:28 +0000</creation_ts>
          <short_desc>[XQuery] 4.14 Variable Declaration: circularity</short_desc>
          <delta_ts>2006-11-02 09:13:53 +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>XQuery 1.0</component>
          <version>Candidate Recommendation</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Dyck">jmdyck</reporter>
          <assigned_to name="Don Chamberlin">chamberl</assigned_to>
          
          
          <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>12506</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2006-10-17 07:41:28 +0000</bug_when>
    <thetext>4.14 Variable Declaration
&quot;If an initializing expression cannot be evaluated because of a circularity (for example, it depends on a function that in turn depends on the value of the variable that is being initialized), a static error is raised [err:XQST0054].&quot;

Why is there no definition for &quot;circularity&quot;? Here are some guesses:

-- You think that the meaning is clear enough, and everyone who reads the quoted sentence will know exactly what you mean. (In which case, I disagree.)

-- You concede that the meaning is not clear from the above sentence, and that people/implementations might disagree on what constitutes &quot;circularity&quot;, but that&apos;s okay: you don&apos;t wish to constrain implementations to use a particular definition. (In which case, I think you should explicitly say that the meaning of &quot;circularity&quot; is implementation-dependent (or -defined).)

-- You concede that the meaning is not clear from the above sentence, and that people/implementations might disagree on what constitutes &quot;circularity&quot;, and that&apos;s not okay: you have a particular meaning in mind that you would like everyone to use, but you don&apos;t know how to express it.


This issue has been raised before, most recently here (I think):
  http://lists.w3.org/Archives/Public/public-qt-comments/2004Aug/0026.html
This was supposedly given an official response here:
  http://lists.w3.org/Archives/Public/public-qt-comments/2004Aug/0100.html
But then this:
  http://lists.w3.org/Archives/Public/public-qt-comments/2004Aug/0112.html
appears to reopen the issue, with no subsequent resolution that I can find.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12513</commentid>
    <comment_count>1</comment_count>
    <who name="Don Chamberlin">chamberl</who>
    <bug_when>2006-10-17 18:29:43 +0000</bug_when>
    <thetext>Michael,
On Oct. 17, 2006, the Query Working Group considered your comment and decided to replace the sentence in XQuery Section 4.14 dealing with &quot;circularity&quot; with the following specification:

A variable $x &quot;depends on&quot; a variable $y or a function f2 if $y or f2 appears in the initializing expression of $x. A function f1 &quot;depends on&quot; a variable $y or a function f2 if $y or f2 appears in the body of f1. If a variable depends on itself by any combination of direct or transitive dependencies, a static error is raised [XQST0054].

The working group believes that this change addresses your issue. If you agree, please change the status of this bug report to Closed.

Regards,
Don Chamberlin (for the Query Working Group)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12522</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2006-10-18 05:08:07 +0000</bug_when>
    <thetext>That certainly goes a long way toward addressing my issue, but I think there&apos;s still some uncertainty left. Consider:

    declare variable $x = f();
    declare function f()
    {
        let $x := 42 return $x
    };

$x depends on f(), and f() depends on $x, so $x would appear to depend on itself, except that the two $x&apos;s aren&apos;t really the same variable. Or are they?

Similarly:

    declare variable $x = f(42);
    declare function f($x)
    {
        $x
    };</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12523</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2006-10-18 08:07:55 +0000</bug_when>
    <thetext>No, I don&apos;t think there&apos;s any uncertainty. The sentence clearly describes a relation between variables, not between variable names. The fact that two variables can have the same name is completely irrelevant. 

A more pendantic definition might be

A variable binding $x &quot;depends on&quot; a variable binding $y or a function f2 if a variable reference bound to $y or a function call bound to f2 appears
in the initializing expression of $x. A function f1 &quot;depends on&quot; a variable binding $y or a function f2 if a variable reference bound to $y or a function call bound to f2 appears in the body of f1. If a variable binding depends
on itself by any combination of direct or transitive dependencies, a static
error is raised [XQST0054].

... but I would have thought any reader capable of understanding that would also understand the text that Don proposed.

Michael, we are trying very hard at the moment to close out the last few issues and get the specs finished. Technically, we closed to new comments months ago, but we are still keeping the lists open so that serious errors can be reported. We can&apos;t keep wordsmithing for ever: there are people who want these specs finished.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12538</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2006-10-19 02:35:34 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt;
&gt; No, I don&apos;t think there&apos;s any uncertainty. The sentence clearly describes a
&gt; relation between variables, not between variable names.

I disagree re &quot;clearly&quot;. True, it uses the word &quot;variable&quot; and not &quot;variable name&quot;, but it also refers to &quot;$x&quot; and &quot;$y&quot;, which are variable names (or, strictly speaking, *contain* variable names), not variables. (You could avoid that particular problem by referring to, say, &quot;V&lt;sub&gt;1&lt;/sub&gt;&quot; and &quot;V&lt;sub&gt;2&lt;/sub&gt;&quot;, i.e., by making them look as different as possible from concrete variable references, but I don&apos;t think it would increase the clarity that much; the problem is that on the whole, the spec doesn&apos;t make that much of a distinction between variables and variable names.)

&gt; The fact that two variables can have the same name is completely irrelevant.

That might be worth saying in the spec, but I think I have a better suggestion...


&gt; A more pendantic definition might be
&gt; 
&gt; A variable binding $x &quot;depends on&quot; a variable binding $y or a function f2 if a
&gt; variable reference bound to $y or a function call bound to f2 appears
&gt; in the initializing expression of $x. A function f1 &quot;depends on&quot; a variable
&gt; binding $y or a function f2 if a variable reference bound to $y or a function
&gt; call bound to f2 appears in the body of f1. If a variable binding depends
&gt; on itself by any combination of direct or transitive dependencies, a static
&gt; error is raised [XQST0054].

Well, if we&apos;re getting pedantic, then:

-- The only bolded occurrence of &quot;variable binding&quot; (in 4.14) strongly suggests that a variable declaration is not a variable binding. So a &quot;variable binding&quot; is exactly what the definition of &quot;depends on&quot; should *not* be concerned with. (Moreover, the spec seems generally undecided on whether a &quot;variable binding&quot; is a static or dynamic thing, and whether it binds a variable to a value or an expression.)

-- According to 3.1.2, a variable reference is not &quot;bound to&quot; a variable binding, it &quot;matches&quot; or &quot;refers to&quot; a variable binding.

-- There&apos;s no basis for the phrase &quot;a function call bound to [the function] f2&quot;. (Mind you, I don&apos;t think the spec provides any verb for that relation.)

&gt; ... but I would have thought any reader capable of understanding that would
&gt; also understand the text that Don proposed.

I think the second one, despite my pedantic objections, would have given me less uncertainty about your intent than the first one did.

However, I think you can do better (convey your intent without uncertainty, and without pedantry): instead of making &quot;depends on&quot; a relation on variables and functions (or variable bindings and functions), make it a relation on variable declarations and function declarations. E.g.:

     A variable declaration V1 &quot;depends on&quot; a variable declaration V2
     or a function declaration F2 if a use of V2 or F2 appears in the
     initializing expression of V1.
     etc.
     [or maybe &quot;reference to&quot; instead of &quot;use of&quot;]

This gets away from the not-that-well-defined notions of &quot;variable&quot; and &quot;variable binding&quot;, and instead couches the definition (as much as possible) in the nice solidly static world of syntax, where it&apos;s clear that (e.g.)
    let $x := 42 return $x
does not contain a variable declaration or a use of one, and so does not enter into the &quot;depends on&quot; relation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12539</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2006-10-19 02:37:07 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt;
&gt; Michael, we are trying very hard at the moment to close out the last few
&gt; issues and get the specs finished.

Good luck with that!

&gt; Technically, we closed to new comments months ago,

Oh? Was there an announcement to that effect? The spec itself didn&apos;t give a deadline for comments.

And technically, this isn&apos;t a new comment, it&apos;s an old comment that never got properly resolved.

&gt; but we are still keeping the lists open so that serious errors can be
&gt; reported.

Am I to infer that this wasn&apos;t a serious error, and shouldn&apos;t have been reported?

&gt; We can&apos;t keep wordsmithing for ever: there are people who want these specs
&gt; finished.

I&apos;ve been unable to find a polite reply to that statement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12767</commentid>
    <comment_count>6</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2006-11-02 00:45:06 +0000</bug_when>
    <thetext>The Working Group is grateful for your interest in the documents. After serious discussion, the WG has decided not to make the change suggested in comment #5. 

In response to your comment &quot;Was there an announcement to that effect? The spec itself didn&apos;t give a deadline for comments.&quot;, we would like to point to the following text in the Status section of the CR documents: This specification will remain a Candidate Recommendation until at least 28 February 2006.

That sentence means that all comments submitted prior to that date must be handled by the WGs before progression is possible. Comments submitted after that date may be handled at the discretion of the WG. If they are not handled in version 1.0, they must be addressed either in an erratum or in some future version of the spec. This particular bug was entered on 17 October, long after the comment period had elapse. 

Again, thank you for your interest. </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12777</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2006-11-02 09:13:53 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; The Working Group is grateful for your interest in the documents.

That&apos;s nice to hear.

&gt; After serious discussion, the WG has decided not to make the change
&gt; suggested in comment #5.

Okay. Although I think you mean Comment #4.
 
&gt; &quot;This specification
&gt; will remain a Candidate Recommendation until at least 28 February 2006.&quot;

Yes, &quot;this CR will remain a CR until at least 3 months ago&quot;. Not very informative on the face of it.

&gt; That sentence means that all comments submitted prior to that date must be
&gt; handled by the WGs before progression is possible. Comments submitted after
&gt; that date may be handled at the discretion of the WG. If they are not handled
&gt; in version 1.0, they must be addressed either in an erratum or in some future
&gt; version of the spec.

Perhaps the spec should have said that then.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>