File: AA-3-8-1.html

package info (click to toggle)
ada-reference-manual 20021112web-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, sarge
  • size: 18,652 kB
  • ctags: 8,921
  • sloc: makefile: 52; sh: 20
file content (285 lines) | stat: -rw-r--r-- 21,377 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
    <TITLE>AARM95 - Variant Parts and Discrete Choices</TITLE>
    <META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
    <META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
    <STYLE type="text/css">
    DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
    TT {font-family: "Courier New", monospace}
    DT {display: compact}
    DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
    DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Index {font-family: "Times New Roman", Times, serif}
    DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
    DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
    DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left:  10.0em; margin-bottom: 0.6em}
    DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
    DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left:  15.0em; margin-bottom: 0.6em}
    UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
    DD.Hanging {margin-left: 6.0em}
    DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.IndentedHanging {margin-left: 2.0em}
    DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.HangingInBulleted {margin-left: 4.0em}
    DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallHanging {margin-left: 7.5em}
    DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallIndentedHanging {margin-left: 2.0em}
    DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallHangingInBulleted {margin-left: 5.0em}
    DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.Enumerated {margin-left: 2.0em}
    DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallEnumerated {margin-left: 2.5em}
    DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    </STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="AA-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-3-8.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-3-9.html">Next</A></P>
<HR>
<H1> 3.8.1 Variant Parts and Discrete Choices</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;A record type with a <FONT FACE="Arial, Helvetica">variant_part</FONT>
specifies alternative lists of components. Each <FONT FACE="Arial, Helvetica">variant</FONT>
defines the components for the value or values of the discriminant covered
by its <FONT FACE="Arial, Helvetica">discrete_choice_list</FONT>. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>1.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B><A NAME="I2007"></A><FONT FACE="Arial, Helvetica">Discrete_choice_list</FONT>s
and <FONT FACE="Arial, Helvetica">discrete_choice</FONT>s are said to
<I>cover</I> values as defined below; which <FONT FACE="Arial, Helvetica">discrete_choice_list</FONT>
covers a value determines which of various alternatives is chosen. These
are used in <FONT FACE="Arial, Helvetica">variant_part</FONT>s, <FONT FACE="Arial, Helvetica">array_aggregate</FONT>s,
and <FONT FACE="Arial, Helvetica">case_statement</FONT>s. </FONT></DIV>

<H4 ALIGN=CENTER>Language Design Principles</H4>
<DIV Class="Paranum"><FONT SIZE=-2>1.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The definition of ``cover'' in
this subclause and the rules about discrete choices are designed so that
they are also appropriate for array aggregates and case statements.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>1.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The rules of this subclause intentionally
parallel those for case statements. </FONT></DIV>

<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">variant_part<A NAME="I2008"></A>
::= </FONT><BR>
&nbsp;&nbsp;&nbsp;<B>case</B>&nbsp;<I>discriminant_</I><A NAME="I2009"></A><FONT FACE="Arial, Helvetica">direct_name</FONT>&nbsp;<B>is</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I2010"></A><FONT FACE="Arial, Helvetica">variant</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<A NAME="I2011"></A><FONT FACE="Arial, Helvetica">variant</FONT>}<BR>
&nbsp;&nbsp;&nbsp;<B>end</B>&nbsp;<B>case</B>;</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">variant<A NAME="I2012"></A>
::= </FONT><BR>
&nbsp;&nbsp;&nbsp;<B>when</B>&nbsp;<A NAME="I2013"></A><FONT FACE="Arial, Helvetica">discrete_choice_list</FONT>&nbsp;=&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I2014"></A><FONT FACE="Arial, Helvetica">component_list</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">discrete_choice_list<A NAME="I2015"></A>
::= </FONT><A NAME="I2016"></A><FONT FACE="Arial, Helvetica">discrete_choice</FONT>&nbsp;{|&nbsp;<A NAME="I2017"></A><FONT FACE="Arial, Helvetica">discrete_choice</FONT>}</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">discrete_choice<A NAME="I2018"></A>
::= </FONT><A NAME="I2019"></A><FONT FACE="Arial, Helvetica">expression</FONT>&nbsp;|&nbsp;<A NAME="I2020"></A><FONT FACE="Arial, Helvetica">discrete_range</FONT>&nbsp;|&nbsp;<B>others</B></DIV>

<H4 ALIGN=CENTER>Name Resolution Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I2021"></A>The <I>discriminant_</I><FONT FACE="Arial, Helvetica">direct_name</FONT>
shall resolve to denote a discriminant (called the <I>discriminant of
the <FONT FACE="Arial, Helvetica">variant_part</FONT></I>) specified
in the <FONT FACE="Arial, Helvetica">known_discriminant_part</FONT> of
the <FONT FACE="Arial, Helvetica">full_type_declaration</FONT> that contains
the <FONT FACE="Arial, Helvetica">variant_part</FONT>. <A NAME="I2022"></A>The
expected type for each <FONT FACE="Arial, Helvetica">discrete_choice</FONT>
in a <FONT FACE="Arial, Helvetica">variant</FONT> is the type of the
discriminant of the <FONT FACE="Arial, Helvetica">variant_part</FONT>.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>A <FONT FACE="Arial, Helvetica">full_type_declaration</FONT>
with a <FONT FACE="Arial, Helvetica">variant_part</FONT> has to have
a (new) <FONT FACE="Arial, Helvetica">known_discriminant_part</FONT>;
the discriminant of the <FONT FACE="Arial, Helvetica">variant_part</FONT>
cannot be an inherited discriminant. </FONT></DIV>

<H4 ALIGN=CENTER>Legality Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;The discriminant of the <FONT FACE="Arial, Helvetica">variant_part</FONT>
shall be of a discrete type. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>It shall
not be of an access type, named or anonymous.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;The <FONT FACE="Arial, Helvetica">expression</FONT>s
and <FONT FACE="Arial, Helvetica">discrete_range</FONT>s given as <FONT FACE="Arial, Helvetica">discrete_choice</FONT>s
in a <FONT FACE="Arial, Helvetica">variant_part</FONT> shall be static.
The <FONT FACE="Arial, Helvetica">discrete_choice</FONT> <B>others</B>
shall appear alone in a <FONT FACE="Arial, Helvetica">discrete_choice_list</FONT>,
and such a <FONT FACE="Arial, Helvetica">discrete_choice_list</FONT>,
if it appears, shall be the last one in the enclosing construct.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;<A NAME="I2023"></A>A
<FONT FACE="Arial, Helvetica">discrete_choice</FONT> is defined to <I>cover
a value</I> in the following cases: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>A <FONT FACE="Arial, Helvetica">discrete_choice</FONT>
that is an <FONT FACE="Arial, Helvetica">expression</FONT> covers a value
if the value equals the value of the <FONT FACE="Arial, Helvetica">expression</FONT>
converted to the expected type.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>A <FONT FACE="Arial, Helvetica">discrete_choice</FONT>
that is a <FONT FACE="Arial, Helvetica">discrete_range</FONT> covers
all values (possibly none) that belong to the range.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The <FONT FACE="Arial, Helvetica">discrete_choice</FONT>
<B>others</B> covers all values of its expected type that are not covered
by previous <FONT FACE="Arial, Helvetica">discrete_choice_list</FONT>s
of the same construct. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>12.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>For <FONT FACE="Arial, Helvetica">case_statement</FONT>s,
this includes values outside the range of the static subtype (if any)
to be covered by the choices. It even includes values outside the base
range of the case expression's type, since values of numeric types (and
undefined values of any scalar type?) can be outside their base range.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I2024"></A>A <FONT FACE="Arial, Helvetica">discrete_choice_list</FONT>
covers a value if one of its <FONT FACE="Arial, Helvetica">discrete_choice</FONT>s
covers the value.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;The possible values
of the discriminant of a <FONT FACE="Arial, Helvetica">variant_part</FONT>
shall be covered as follows: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>If the discriminant is of a static constrained scalar subtype,
then each non-<B>others</B> <FONT FACE="Arial, Helvetica">discrete_choice</FONT>
shall cover only values in that subtype, and each value of that subtype
shall be covered by some <FONT FACE="Arial, Helvetica">discrete_choice</FONT>
[(either explicitly or by <B>others</B>)];</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>If the type of the discriminant is a descendant of a generic
formal scalar type then the <FONT FACE="Arial, Helvetica">variant_part</FONT>
shall have an <B>others</B> <FONT FACE="Arial, Helvetica">discrete_choice</FONT>;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>16.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>The base range
is not known statically in this case.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Otherwise, each value of the base range of the type of
the discriminant shall be covered [(either explicitly or by <B>others</B>)].
</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;Two distinct <FONT FACE="Arial, Helvetica">discrete_choice</FONT>s
of a <FONT FACE="Arial, Helvetica">variant_part</FONT> shall not cover
the same value.</DIV>

<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;If the <FONT FACE="Arial, Helvetica">component_list</FONT>
of a <FONT FACE="Arial, Helvetica">variant</FONT> is specified by <B>null</B>,
the variant has no components.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I2025"></A><A NAME="I2026"></A>The discriminant
of a <FONT FACE="Arial, Helvetica">variant_part</FONT> is said to <I>govern</I>
the <FONT FACE="Arial, Helvetica">variant_part</FONT> and its <FONT FACE="Arial, Helvetica">variant</FONT>s.
In addition, the discriminant of a derived type governs a <FONT FACE="Arial, Helvetica">variant_part</FONT>
and its <FONT FACE="Arial, Helvetica">variant</FONT>s if it corresponds
(see <A HREF="AA-3-7.html">3.7</A>) to the discriminant of the <FONT FACE="Arial, Helvetica">variant_part</FONT>.</DIV>

<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;A record value contains the values of the components
of a particular <FONT FACE="Arial, Helvetica">variant</FONT> only if
the value of the discriminant governing the <FONT FACE="Arial, Helvetica">variant</FONT>
is covered by the <FONT FACE="Arial, Helvetica">discrete_choice_list</FONT>
of the <FONT FACE="Arial, Helvetica">variant</FONT>. This rule applies
in turn to any further <FONT FACE="Arial, Helvetica">variant</FONT> that
is, itself, included in the <FONT FACE="Arial, Helvetica">component_list</FONT>
of the given <FONT FACE="Arial, Helvetica">variant</FONT>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I2027"></A>The elaboration of a <FONT FACE="Arial, Helvetica">variant_part</FONT>
consists of the elaboration of the <FONT FACE="Arial, Helvetica">component_list</FONT>
of each <FONT FACE="Arial, Helvetica">variant</FONT> in the order in
which they appear. </DIV>

<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;<I>Example of record
type with a variant part: </I></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Device&nbsp;<B>is</B>&nbsp;(Printer,&nbsp;Disk,&nbsp;Drum);<BR>
<B>type</B>&nbsp;State&nbsp;&nbsp;<B>is</B>&nbsp;(Open,&nbsp;Closed);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Peripheral(Unit&nbsp;:&nbsp;Device&nbsp;:=&nbsp;Disk)&nbsp;<B>is</B><BR>
&nbsp;&nbsp;&nbsp;<B>record</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Status&nbsp;:&nbsp;State;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>case</B>&nbsp;Unit&nbsp;<B>is</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>when</B>&nbsp;Printer&nbsp;=&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Line_Count&nbsp;:&nbsp;Integer&nbsp;<B>range</B>&nbsp;1&nbsp;..&nbsp;Page_Size;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>when</B>&nbsp;<B>others</B>&nbsp;=&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cylinder&nbsp;&nbsp;&nbsp;:&nbsp;Cylinder_Index;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Track&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;Track_Number;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>end</B>&nbsp;<B>case</B>;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>end</B>&nbsp;<B>record</B>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DIV Class="Wide" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;<I>Examples of record
subtypes:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DIV Class="Examples"><TT><B>subtype</B>&nbsp;Drum_Unit&nbsp;<B>is</B>&nbsp;Peripheral(Drum);<BR>
<B>subtype</B>&nbsp;Disk_Unit&nbsp;<B>is</B>&nbsp;Peripheral(Disk);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Wide" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;<I>Examples of constrained
record variables:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<DIV Class="Examples"><TT>Writer&nbsp;&nbsp;&nbsp;:&nbsp;Peripheral(Unit&nbsp;&nbsp;=&gt;&nbsp;Printer);<BR>
Archive&nbsp;&nbsp;:&nbsp;Disk_Unit;</TT></DIV>

<H4 ALIGN=CENTER>Extensions to Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>29.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><A NAME="I2028"></A>In Ada 83,
the discriminant of a <FONT FACE="Arial, Helvetica">variant_part</FONT>
is not allowed to be of a generic formal type. This restriction is removed
in Ada 95; an <B>others</B> <FONT FACE="Arial, Helvetica">discrete_choice</FONT>
is required in this case. </FONT></DIV>

<H4 ALIGN=CENTER>Wording Changes from Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>29.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The syntactic category <FONT FACE="Arial, Helvetica">choice</FONT>
is removed. The syntax rules for <FONT FACE="Arial, Helvetica">variant</FONT>,
<FONT FACE="Arial, Helvetica">array_aggregate</FONT>, and <FONT FACE="Arial, Helvetica">case_statement</FONT>
now use <FONT FACE="Arial, Helvetica">discrete_choice_list</FONT> or
<FONT FACE="Arial, Helvetica">discrete_choice</FONT> instead. The syntax
rule for <FONT FACE="Arial, Helvetica">record_aggregate</FONT> now defines
its own syntax for named associations.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>We have added the term Discrete
Choice to the title since this is where they are talked about. This is
analogous to the name of the subclause &quot;Index Constraints and Discrete
Ranges&quot; in the clause on Array Types.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The rule requiring that the discriminant
denote a discriminant of the type being defined seems to have been left
implicit in RM83. </FONT></DIV>

<HR>
<P><A HREF="AA-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-3-8.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-3-9.html">Next</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>