Skip to content

Commit

Permalink
Drop use of union(A,B) syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhkay committed May 14, 2024
1 parent 0ed65bc commit 27a34dd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 25 deletions.
4 changes: 2 additions & 2 deletions specifications/xpath-datamodel-40/src/xpath-datamodel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1172,8 +1172,8 @@ more than one other type. Examples include functions
(<code>function(xs:string) as xs:int</code> is substitutable for
<code>function(xs:NCName) as xs:int</code> and also for
<code>function(xs:string) as xs:decimal</code>), and union types
(<code>A</code> is substitutable for <code>union(A, B)</code> and also
for <code>union(A, C)</code>). In XDM, item types include node types,
(<code>A</code> is substitutable for the union type <code>(A | B)</code> and also
for the union type <code>(A | C)</code>). In XDM, item types include node types,
function types, and built-in atomic types. The list, which shows only
hierarchic relationships, is therefore a simplification of the full
model.</p>
Expand Down
12 changes: 6 additions & 6 deletions specifications/xpath-functions-40/src/xpath-functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -763,8 +763,8 @@ more than one other type. Examples include functions
(<code>function(xs:string) as xs:int</code> is substitutable for
<code>function(xs:NCName) as xs:int</code> and also for
<code>function(xs:string) as xs:decimal</code>), and union types
(<code>A</code> is substitutable for <code>union(A, B)</code> and also
for <code>union(A, C)</code>. In XDM, item types include node types,
(<code>A</code> is substitutable for the union type <code>(A | B)</code> and also
for <code>(A | C)</code>. In XDM, item types include node types,
function types, and built-in atomic types. The diagram, which shows
only hierarchic relationships, is therefore a simplification of the
full model.</p>
Expand Down Expand Up @@ -6491,8 +6491,8 @@ correctly in all browsers, depending on the system configuration.</emph></p>-->
<code>fn:parse-html</code> function.</p>
<example role="record">
<record id="parse-html-options">
<arg name="method" type="union(enum(&quot;html&quot;, &quot;xhtml&quot;), xs:string)"/>
<arg name="html-version" type="union(enum(&quot;LS&quot;), xs:decimal)"/>
<arg name="method" type="(enum(&quot;html&quot; | &quot;xhtml&quot;), xs:string)"/>
<arg name="html-version" type="(enum(&quot;LS&quot;) | xs:decimal)"/>
<arg name="encoding?" type="xs:string?"/>
<arg name="include-template-content?" type="xs:boolean?"/>
<arg name="*"/>
Expand Down Expand Up @@ -7127,7 +7127,7 @@ Field 2A,Field 2B,Field 2C,Field 2D'
row of the CSV data. </p></item>
<item><p><code>get</code> is a function providing ready access to a given
field in a given row. The function has signature:</p>
<eg>function($row as xs:integer, $column as union(xs:string, xs:integer)) as xs:string?</eg>
<eg>function($row as xs:positiveInteger, $column as (xs:string | xs:positiveInteger)) as xs:string?</eg>
<p>The function takes two arguments: the first is an integer giving the
row number (1-based), the second identifies a column either by its name
or by its 1-based position.</p></item>
Expand Down Expand Up @@ -12039,7 +12039,7 @@ ISBN 0 521 77752 6.</bibl>
</item>
<item diff="add" at="issue780">
<p>The type of the third argument of <code>fn:format-number</code> has
changed from <code>xs:string</code> to <code>union(xs:string, xs:QName)</code>.
changed from <code>xs:string</code> to <code>(xs:string | xs:QName)</code>.
Because the expected type of this parameter is no longer <code>xs:string</code>, the
special coercion rules for <code>xs:string</code> parameters no longer apply.
For example, it is no
Expand Down
23 changes: 13 additions & 10 deletions specifications/xquery-40/src/expressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6212,17 +6212,17 @@ name.</p>
<example diff="add" at="B">
<head>Examples:</head>
<ulist>
<item><p><code>union(xs:short, xs:long) ⊆ xs:integer</code>
<item><p><code>(xs:short | xs:long) ⊆ xs:integer</code>
because <code>xs:short ⊆ xs:integer</code> and <code>xs:long ⊆ xs:integer</code>.</p></item>
<item><p><code>union(P, Q) ⊆ union(P, Q, R)</code>
because <code>P ⊆ union(P, Q, R)</code> and <code>Q ⊆ union(P, Q, R)</code>.</p></item>
<item><p><code>(P | Q) ⊆ (P | Q | R)</code>
because <code>P ⊆ (P | Q | R)</code> and <code>Q ⊆ (P | Q | R)</code>.</p></item>
<item><p><code>enum("red", "green") ⊆ xs:string</code> because the
enumeration type <code>enum("red") ⊆ xs:string</code>
and <code>enum("green") ⊆ xs:string</code>.</p></item>
<item><p><code>enum("red", "green") ⊆ enum("red", "green", "blue")</code> because
<code>enum("red") ⊆ enum("red", "green", "blue")</code> and
<code>enum("green") ⊆ enum("red", "green", "blue")</code>.</p></item>
<item><p><code>enum("red", "green", "blue") ⊆ union(enum("red", "green"), enum("blue"))</code> because
<item><p><code>enum("red", "green", "blue") ⊆ (enum("red", "green") | enum("blue"))</code> because
each of the types <code>enum("red")</code>, <code>enum("green")</code>, and <code>enum("blue")</code>
is a subtype of one of the two members of the union type.</p></item>
</ulist>
Expand Down Expand Up @@ -6822,9 +6822,9 @@ name.</p>
<p>Where an item type contains a reference to a named item type that is non-recursive, the reference
is expanded, recursively, as the first step in evaluating the subtype relationship. For example
this means that if <var>U</var> is a named item type with the expansion
<code>union(xs:integer, xs:double)</code>,
<code>(xs:integer | xs:double)</code>,
then <code>xs:integer ⊆ U</code> is true, because
<code>xs:integer ⊆ union(xs:integer, xs:double)</code> is true.</p>
<code>xs:integer ⊆ (xs:integer | xs:double)</code> is true.</p>
<p>Recursive types are considered to be, in the terminology of the computer science
literature, <term>iso-recursive</term> (rather than <term>equi-recursive</term>).
This means that a recursive type name is not
Expand Down Expand Up @@ -10757,10 +10757,13 @@ return $incrementors[2](4)]]></eg>
</olist>

<note>
<p>The semantics of the path operator can also be defined using the simple map operator (<code>!</code>) as follows (forming the union with an empty sequence <code>($R union ())</code> has the effect of eliminating duplicates and sorting nodes into document order):</p>
<p>The semantics of the path operator can also be defined using the simple
map operator (<code>!</code>) as follows (the function
<code>fn:distinct-ordered-nodes($R)</code> has the effect of
eliminating duplicates and sorting nodes into document order):</p>
<eg><![CDATA[let $R := E1 ! E2
return if (every $r in $R satisfies $r instance of node())
then ($R union ())
then (fn:distinct-ordered-nodes($R))
else if (every $r in $R satisfies not($r instance of node()))
then $R
else error()]]></eg>
Expand Down Expand Up @@ -21331,7 +21334,7 @@ The result of a cast expression is one of the following:
to casting to an anonymous atomic type derived from <code>xs:string</code>
whose enumeration facet restricts the value space to the single string <code>"red"</code>,
while <code>cast $x as enum("red", "green")</code> is equivalent to casting
to <code>union(enum("red"), enum("green"))</code>.</p></note>
to <code>(enum("red") | enum("green"))</code>.</p></note>


</item>
Expand Down Expand Up @@ -21472,7 +21475,7 @@ usa:zipcode?)</code>.</p>
</item>
<item>
<p>If <code>my:chrono</code> is a named item type that expands to
<code>union(xs:date, xs:time, xs:dateTime)</code>, then the result
<code>(xs:date | xs:time | xs:dateTime)</code>, then the result
of <code>my:chrono("12:00:00Z")</code> is the <code>xs:time</code>
value <code>12:00:00Z</code>.</p>
</item>
Expand Down
14 changes: 7 additions & 7 deletions specifications/xslt-40/src/function-catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@
<fos:function name="key">
<fos:signatures>
<fos:proto name="key" return-type="node()*">
<fos:arg name="key-name" type="union(xs:string, xs:QName)"/>
<fos:arg name="key-name" type="(xs:string | xs:QName)"/>
<fos:arg name="key-value" type="xs:anyAtomicType*"/>
<fos:arg name="top" type="node()" default="/" usage="navigation"/>
</fos:proto>
Expand Down Expand Up @@ -1463,7 +1463,7 @@
<fos:function name="system-property">
<fos:signatures>
<fos:proto name="system-property" return-type="xs:string">
<fos:arg name="name" type="union(xs:string, xs:QName)"/>
<fos:arg name="name" type="(xs:string | xs:QName)"/>
</fos:proto>
</fos:signatures>
<fos:properties>
Expand Down Expand Up @@ -1681,7 +1681,7 @@
<fos:function name="function-available" prefix="fn">
<fos:signatures>
<fos:proto name="function-available" return-type="xs:boolean">
<fos:arg name="name" type="union(xs:string, xs:QName)"/>
<fos:arg name="name" type="(xs:string | xs:QName)"/>
<fos:arg name="arity" type="xs:integer?" default="()"/>
</fos:proto>
</fos:signatures>
Expand Down Expand Up @@ -1842,7 +1842,7 @@
<fos:function name="element-available" prefix="fn">
<fos:signatures>
<fos:proto name="element-available" return-type="xs:boolean">
<fos:arg name="name" type="union(xs:string, xs:QName)"/>
<fos:arg name="name" type="(xs:string | xs:QName)"/>
</fos:proto>
</fos:signatures>
<fos:properties>
Expand Down Expand Up @@ -1958,7 +1958,7 @@
<fos:function name="type-available" prefix="fn">
<fos:signatures>
<fos:proto name="type-available" return-type="xs:boolean">
<fos:arg name="name" type="union(xs:string, xs:QName)"/>
<fos:arg name="name" type="(xs:string | xs:QName)"/>
</fos:proto>
</fos:signatures>
<fos:properties>
Expand Down Expand Up @@ -2081,7 +2081,7 @@
<fos:function name="accumulator-before">
<fos:signatures>
<fos:proto name="accumulator-before" return-type="item()*">
<fos:arg name="name" type="union(xs:string, xs:QName)"/>
<fos:arg name="name" type="(xs:string | xs:QName)"/>
</fos:proto>
</fos:signatures>
<fos:properties>
Expand Down Expand Up @@ -2209,7 +2209,7 @@
<fos:function name="accumulator-after">
<fos:signatures>
<fos:proto name="accumulator-after" return-type="item()*">
<fos:arg name="name" type="union(xs:string, xs:QName)"/>
<fos:arg name="name" type="(xs:string | xs:QName)"/>
</fos:proto>
</fos:signatures>
<fos:properties>
Expand Down

0 comments on commit 27a34dd

Please sign in to comment.