<?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>1677</bug_id>
          
          <creation_ts>2005-07-17 07:42:14 +0000</creation_ts>
          <short_desc>[FS] editorial: 4.12.2 Typeswitch</short_desc>
          <delta_ts>2007-02-25 23:16:37 +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>Formal Semantics 1.0</component>
          <version>Last Call drafts</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</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="Jerome Simeon">simeon</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>4763</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2005-07-17 07:42:14 +0000</bug_when>
    <thetext>4.12.2 Typeswitch

Introduction

&quot;This variable is optional in [XPath/XQuery] but mandatory in the
[XPath/XQuery] Core.&quot;
    Not according to the Core Grammar.

&quot;One of the reasons for having this variable is that it is assigned a
specific type for the corresponding branch.&quot;
    Is this a reason for requiring the variables in the Core, or a reason
    for someone to use them in XQuery? If the former, I don&apos;t find it
    convincing. If the latter, reword and move it before the preceding
    sentence, so it isn&apos;t mistaken for the former.

Core Grammar
    I guess you should make the $VarNames mandatory, if that&apos;s what you
    want.

Norm
&quot;The following normalization rule adds a newly created variable that does
not appear in the rest of the query. Note that $fs:new is a newly
generated variable that must not conflict with any variables already in
scope and that is not used in any of the sub-expressions.&quot;
    These two sentences say roughly the same thing. Merge.
    Also, s/rule/rules/, as it applies to rules 1 and 3.

Notation 2

&quot;The following auxiliary grammar production is used to identify branches
of the typeswitch.&quot;
    I don&apos;t think &quot;identify&quot; is the correct verb. CaseRules is a
    right-recursive restructuring of the clauses of a TypeswitchExpr.

&quot;[79 (Formal)] CaseRules ::= ...&quot;
    Why not use this in the actual Core grammar?
    (leftover from last year, comment #111)

    I don&apos;t think &apos;CaseRules&apos; is a very good name, especially in a
    document where &quot;rule&quot; already means something quite different.
    How about &apos;CaseClauses&apos;?

&quot;statEnv |- Type1 case CaseRules : Type&quot;
    No, this judgment is not applied to CaseRules, but only to individual
    clauses. So, you could declare it twice, once for CaseClause and once
    for a default clause. (It would help if Core had a DefaultCaseClause.)

is used in the static of&quot;
    Insert &quot;semantics&quot; after &quot;static&quot;?

&quot;the given case rule yields the type Type&quot;
    s/rule/clause/

&quot;the given case rules yields the value Value2.&quot;
    s/rules/clauses/
    s/yields/yield/

DEv

&quot;the remaining case rules are evaluated order&quot;
    s/rules/clauses/
    Insert &quot;in&quot; before &quot;order&quot;.

DEv / rule 3 / conclusion
case SequenceType VarRef # -&gt; # case VarRef as SequenceType
leftover comment #112

DErr
&quot;evaluation of any case rule&quot;
    s/rule/clause/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9167</commentid>
    <comment_count>1</comment_count>
    <who name="Jerome Simeon">simeon</who>
    <bug_when>2006-04-11 22:45:53 +0000</bug_when>
    <thetext>Fixed as suggested.
- Jerome
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12265</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2006-10-04 05:26:59 +0000</bug_when>
    <thetext>&quot;The following normalization rules add newly created variables that must not conflict with any variables already in scope and that are not used in any of the sub-expressions.&quot;
    This is still fairly clunky. How about deleting:
        &quot;and that are not used in any of the sub-expressions.&quot;
    It doesn&apos;t seem like an important point.


You didn&apos;t answer the question:
&gt; Why not use this in the actual Core grammar?
I.e., what&apos;s the point of the current Core productions?

Specifically, replace
    [33 (Core)] TypeswitchExpr ::= ...
with
    [33 (Core)] TypeswitchExpr ::= &quot;typeswitch&quot; &quot;(&quot; Expr &quot;)&quot; CaseClauses
    [?? (Core)] CaseClauses ::= (CaseClause CaseClauses) | DefaultCaseClause
    [?? (Core)] DefaultCaseClause ::=
                &quot;default&quot; &quot;$&quot; VarName &quot;return&quot; ExprSingle
and drop [68,69,70 (Formal)]. (And change the &quot;Formal&quot; symbols appropriately where they occur in rules.)


And you missed:
&gt; &quot;the remaining case rules are evaluated&quot;
&gt;     s/rules/clauses/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13598</commentid>
    <comment_count>3</comment_count>
    <who name="Jerome Simeon">simeon</who>
    <bug_when>2007-01-16 17:58:50 +0000</bug_when>
    <thetext>Fixed the text, but left the grammar unchanged, defined at the XQuery
1.0 level.

- Jerome

</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>