<?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>10368</bug_id>
          
          <creation_ts>2010-08-14 18:48:49 +0000</creation_ts>
          <short_desc>[XQuery30] review of appendix C re scope of components</short_desc>
          <delta_ts>2011-11-15 21:14:55 +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 3.0</component>
          <version>Member-only Editors Drafts</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Dyck">jmdyck</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>jim.melton</cc>
    
    <cc>mike</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>37419</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2010-08-14 18:48:49 +0000</bug_when>
    <thetext>(This comment is basically my message
http://lists.w3.org/Archives/Member/w3c-xsl-query/2010May/0041.html
from 2010-05-03.)

Here are my comments, all editorial...

&gt; [Definition: The *scope* of a component is the context in which
&gt; the  component is associated with a value.]

(1)
Is this using &quot;context&quot; in the sense of &quot;static or dynamic context&quot;? If 
so, it doesn&apos;t make much sense. For the most part, any given component is 
associated with a value in *every* static/dynamic context, so talking 
about *the* context in which this occurs is probably a mistake.

Or, if you mean &quot;context&quot; in some other sense, that&apos;s probably not a good 
idea, since Appendix C is almost entirely about static and dynamic contexts.


&gt; [Definition: If a component has *global scope*, then every expression
&gt; in the query has the same value for that component, and it can not be
&gt; overwritten by the query module or by an expression.]

(2)
The phrase &quot;every expression ... has the same value&quot; is a garden path: it 
   may mislead the reader into thinking that you&apos;re talking about the 
value of an expression. I suggest that, throughout this appendix, instead 
of talking about the *value* of a component, we use some other word, e.g. 
&quot;setting&quot;. (This is appropriate, because a component&apos;s setting is in 
general not an XDM value.) And/or we could alter the syntax somewhat, e.g.:
     ... then the [value/setting] of that component is the same
     for every expression in the query ...

(3)
The &quot;and&quot; in &quot;and it can not be overwritten by the query module or by an 
expression&quot; suggests that this clause is saying something new, but in 
fact it&apos;s a logical consequence of the preceding clause.

(4)
The phrase &quot;query module&quot; is undefined. I think it&apos;s (currently) used to 
mean &quot;module&quot;, but I think readers might take it to mean &quot;main module&quot; 
(because that&apos;s the module that &quot;contains the query&quot;). I think we should 
avoid it. Instead, just say:
     &quot;by any module or expression&quot;

(5)
(Speaking of &quot;query module&quot;, it looks like the thread I started at
http://lists.w3.org/Archives/Member/w3c-xsl-query/2010Feb/0007.html
never really got resolved.)

(6)
(There&apos;s also an occurrence of &quot;query module&quot; in 4.12.3 that should just 
be &quot;module&quot;.)


&gt; [Definition: If a component has module scope, then every expression
&gt; in a given module has the same value for that component, and it can be
&gt; overwritten or augmented for a given module.]

(7)
Instead of talking about overwriting or augmenting, maybe say something like:
     &quot;but that value [setting] may differ between modules&quot;


&gt; [Definition: If a component has lexical scope, then it is defined by
&gt; a query expression, and its scope is defined by the semantics of the
&gt; expression that defines it.]

(8)
You&apos;re saying that a component is *defined by* an expression. I&apos;m 
inclined to say that context components are defined by section 2.1 
[Expression Context].

(9)
The phrase &quot;defined by a query expression&quot; prompts the question &quot;Which 
query expression?&quot;, which I don&apos;t think is what&apos;s wanted. Maybe
     &quot;set by certain kinds of expression&quot;
would be better. (It prompts the question &quot;Which kinds?&quot;, which has a 
good answer, although we don&apos;t currently give it.)

(10)
By the way, I suggest changing &quot;query expression&quot; to just &quot;expression&quot;.

(11)
It&apos;s odd for the definition of &quot;lexical scope&quot; to say that &quot;its scope is 
defined by [something else]&quot;. That&apos;s getting into another (more 
conventional) meaning of &quot;scope&quot;, which I think muddies the waters.

(12)
This definition diverges from the pattern set up by the previous 
definitions. A more consistent one would be something like:
     [Definition: If a component has lexical scope, then the setting
     of that component is fixed for any given expression, but may differ
     between expressions in the same module.]


&gt; [Definition: If a component has dynamic scope, then it is defined by a
&gt; query expression, its scope is defined by the semantics of the expression
&gt; that defines it, and run-time evaluation may influence its value.]

(8, 9, 10, 11 again)
As above re &quot;defined by a query expression&quot; and &quot;its scope is defined&quot;.

(13)
We should probably delete &quot;run-time&quot;, as its presence might suggest an 
distinction from compile-time evaluation, which we don&apos;t intend.

(14)
A more consistent definition would be something like:
     [Definition: If a component has dynamic scope, then the setting of
     that component may differ between the contexts of a single
     expression.]

----

(15)
As I said here:
http://lists.w3.org/Archives/Member/w3c-xsl-query/2010Mar/0189.html
I think we should replace occurrences of &quot;scope&quot; in Appendix C with a 
different word. There I suggested &quot;range&quot; or &quot;ambit&quot;. Now, I think I&apos;d 
prefer something like &quot;constancy&quot; or &quot;changeability&quot;. E.g.:
     [Definition: The *constancy* of a component indicates (roughly)
     the set of [static or dynamic] contexts in which that component
     has a common setting, or conversely, the level of granularity at
     which the setting of that component may differ between contexts.]

----

(16)
(Note that all of the above is independent of the other issue that it got 
tangled up with, namely that the spec is inconsistent on whether a module 
has a static context. I bring it up just so it doesn&apos;t get forgotten.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37420</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2010-08-14 20:14:27 +0000</bug_when>
    <thetext>I basically agree with the originator that the current text is a mess. However, it would be more constructive to propose a rewording of the entire section (it&apos;s not an easy task).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37421</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2010-08-14 20:34:36 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; it would be more constructive to propose a rewording of the entire section

Including or excluding subsections?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57754</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2011-10-04 05:09:21 +0000</bug_when>
    <thetext>Here is my proposal to resolve this issue:

(A)
Remove all use of appendix C&apos;s specialized meaning for &apos;scope&apos;.

Specifically, remove:
 -- In C, the definition of &quot;scope of a component&quot; + its bullets.
 -- In C.1, the &quot;Scope&quot; bullet and column.
 -- In C.2, the &quot;Scope&quot; bullet and column.
 -- In H, the definitions for:
     -- dynamic scope,
     -- global scope,
     -- lexical scope,
     -- module scope, and
     -- scope of a component.

Outside of appendix C, the only other potential use of that meaning of
&quot;scope&quot; is in 2.1.1 Static Context:
    &quot;Rules governing the scope and initialization of these components
    can be found in C.1 Static Context Components.&quot;
We could delete &quot;the scope and&quot;, or we could just leave it and let it be
interpreted in a traditional sense.

(Note that, in C.1, the consistency rules for
 -- Statically known namespaces
 -- Default element/type namespace
 -- In-scope variables
are of roughly the form:
    &quot;Only one X per Y per lexical scope&quot;
These are using &quot;scope&quot; in a more traditional sense.  So:
 -- They could just stay as is. OR
 -- The &quot;per lexical scope&quot; could be deleted, since it roughly means
    &quot;in a given static context&quot;, which is clearly implied for all
    consistency rules in C.1. OR
 -- The entire consistency rule could be removed, since it&apos;s implied
    by the &quot;data type&quot; of the component. (E.g., &apos;Statically known
    namespaces&apos; and &apos;In-scope variables&apos; are defined as mappings, which
    implies only one &quot;value&quot; per &quot;key&quot;.)
)

This removal is without normative repercussions, because (as I pointed
out in Bug 8873 comment #2) the content of the &quot;scope&quot; column is
redundant, given the content of the &quot;overwritten/augmented by query&quot;
column:

    For components of the static context:
       if it can be overwritten by an expression,
           scope is &quot;lexical&quot;,
       else
           scope is &quot;module&quot;.

    For components of the dynamic context:
        if it can be overwritten/augmented by an expression,
            scope is &quot;dynamic&quot;,
        else
            scope is &quot;global&quot;.

The only exception to the above rule is &apos;XPath 1.0 Compatibility Mode&apos;,
for which the above rule would predict &quot;module&quot;, but which is actually
labelled &quot;global&quot;.  However, its consistency rule (&quot;Must be false&quot;)
renders the distinction uninformative.

(B)
Now, you might say &quot;Okay, it&apos;s redundant, but it&apos;s still a helpful
summary of the preceding column&quot;. My response is:
 -- Its helpfulness is not worth the churn it has caused, and
 -- You could probably achieve a similar effect by:
    (1) Splitting the preceding column into two:
        &quot;Can be overwritten or augmented by prolog?&quot;
        and
        &quot;Can be overwritten or augmented by expressions?&quot;
    (2) Grouping the overwritten-by-expression components together.

--------------

The change in (A) addresses all of the points in comment 1 except
(5), (6), and (16).

Re (5) and (6), see Bug 14374.

Re (16), see Bug 14375.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59695</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2011-11-07 19:06:19 +0000</bug_when>
    <thetext>Meeting #490 of the XQuery WG approved the proposal in comment #3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60059</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2011-11-15 21:14:55 +0000</bug_when>
    <thetext>The editor&apos;s draft of the XQuery document now reflects the proposal in comment #3.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>