Skip to content

Commit

Permalink
Add simplified readonly type
Browse files Browse the repository at this point in the history
Equivalent to union of inherently immutable basic types.
No type parameter.
Fixes #462. First step of #189.
  • Loading branch information
jclark committed Mar 26, 2020
1 parent 17c0ee5 commit 90310dc
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion lang/spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ <h4>Type descriptors</h4>
<td>a sequence of values that can be generated lazily</td>
</tr>
<tr>
<td rowspan="8">other</td>
<td rowspan="9">other</td>
<td>singleton</td>
<td>a single value described by a literal</td>
</tr>
Expand Down Expand Up @@ -577,6 +577,10 @@ <h4>Type descriptors</h4>
<td>the union of (), int, float, decimal, string, and maps and arrays whose
values are, recursively, json</td>
</tr>
<tr>
<td>readonly</td>
<td>the union of all inherently immutable basic types</td>
</tr>
</table>
<p>
In addition to describing a type, a type descriptor may also include information
Expand Down Expand Up @@ -2113,6 +2117,7 @@ <h3>Other type descriptors</h3>
| never-type-descriptor
| byte-type-descriptor
| json-type-descriptor
| readonly-type-descriptor
| type-reference
| <code>(</code> type-descriptor <code>)</code>
</pre>
Expand Down Expand Up @@ -2242,6 +2247,35 @@ <h4>JSON types</h4>
</p>

</section>
<section>
<h4>Readonly type</h4>
<pre
class="grammar">readonly-type-descriptor := <code>readonly</code>
</pre>
<p>
The <code>readonly</code> type is a predefined name for the union of all basic types
that are inherently immutable. These are:
</p>
<ul>
<li>all simple types
<ul>
<li>nil</li>
<li>boolean</li>
<li>int</li>
<li>float</li>
<li>decimal</li>
</ul>
</li>
<li>string</li>
<li>error</li>
<li>function</li>
<li>service</li>
<li>typedesc</li>
<li>handle</li>
</ul>

</section>

<section>
<h4>Type reference</h4>
<pre
Expand Down Expand Up @@ -7550,6 +7584,7 @@ <h2 id="changes">B. Changes since previous versions</h2>
<section>
<h3>Summary of changes from 2020R1 to 2020R2</h3>
<ol>
<li>The <code>readonly</code> type has been added.</li>
<li>The XML item-specific subtypes can be used as constructors, both in
expressions and in binding patterns.</li>
</ol>
Expand Down

0 comments on commit 90310dc

Please sign in to comment.