File: AA-3-9-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 (274 lines) | stat: -rw-r--r-- 21,235 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
    <TITLE>AARM95 - Type Extensions</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-9.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-3-9-2.html">Next</A></P>
<HR>
<H1> 3.9.1 Type Extensions</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;[<A NAME="I2076"></A> <A NAME="I2077"></A><A NAME="I2078"></A><A NAME="I2079"></A><A NAME="I2080"></A><A NAME="I2081"></A>Every
type extension is a tagged type, and is either a <I>record extension</I>
or a <I>private extension</I> of some other tagged type.] </DIV>

<H4 ALIGN=CENTER>Language Design Principles</H4>
<DIV Class="Paranum"><FONT SIZE=-2>1.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>We want to make sure that we can
extend a generic formal tagged type, without knowing its discriminants.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>1.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>We don't want to allow components
in an extension aggregate to depend on discriminants inherited from the
parent value, since such dependence requires staticness in aggregates,
at least for variants. </FONT></DIV>

<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">record_extension_part<A NAME="I2082"></A>
::= </FONT><B>with</B>&nbsp;<A NAME="I2083"></A><FONT FACE="Arial, Helvetica">record_definition</FONT></DIV>

<H4 ALIGN=CENTER>Legality Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;The parent type of a record extension shall not
be a class-wide type. If the parent type is nonlimited, then each of
the components of the <FONT FACE="Arial, Helvetica">record_extension_part</FONT>
shall be nonlimited. <A NAME="I2084"></A>The accessibility level (see
<A HREF="AA-3-10-2.html">3.10.2</A>) of a record extension shall not
be statically deeper than that of its parent type. <A NAME="I2085"></A>In
addition to the places where Legality Rules normally apply (see <A HREF="AA-12-3.html">12.3</A>),
these rules apply also in the private part of an instance of a generic
unit. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>If the parent is
a limited formal type, then the actual might be nonlimited.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>A similar accessibility rule is
not needed for private extensions, because in a package, the rule will
apply to the <FONT FACE="Arial, Helvetica">full_type_declaration</FONT>,
and for a generic formal private extension, the actual is all that matters.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;A type extension shall not be declared in a generic
body if the parent type is declared outside that body. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>This paragraph
ensures that a dispatching call will never attempt to execute an inaccessible
subprogram body.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The part about generic bodies
is necessary in order to preserve the contract model.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4.c</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1>Since
a generic unit can be instantiated at a deeper accessibility level than
the generic unit, it is necessary to prevent type extensions whose parent
is declared outside the generic unit. The same is true if the parent
is a formal of the generic unit. If the parent is declared in the <FONT FACE="Arial, Helvetica">generic_declaration</FONT>
(but is not a formal), we don't run afoul of the accessibility rules,
because we know that the instance declaration and body will be at the
same accessibility level. However, we still have a problem in that case,
because it might have an unknown number of abstract subprograms, as in
the following example: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4.d</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>package</B>&nbsp;P&nbsp;<B>is</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;T&nbsp;<B>is</B>&nbsp;<B>tagged</B>&nbsp;<B>null</B>&nbsp;<B>record</B>;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;F&nbsp;<B>return</B>&nbsp;T;&nbsp;--<I>&nbsp;Inherited&nbsp;versions&nbsp;will&nbsp;be&nbsp;abstract.</I><BR>
<B>end</B>&nbsp;P;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4.e</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>generic</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;TT&nbsp;<B>is</B>&nbsp;<B>tagged</B>&nbsp;<B>private</B>;<BR>
<B>package</B>&nbsp;Gp&nbsp;<B>is</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;NT&nbsp;<B>is</B>&nbsp;<B>abstract&nbsp;new</B>&nbsp;TT&nbsp;<B>with</B>&nbsp;<B>null</B>&nbsp;<B>record</B>;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<B>procedure</B>&nbsp;Q(X&nbsp;:&nbsp;<B>in</B>&nbsp;NT)&nbsp;<B>is&nbsp;abstract</B>;<BR>
<B>end</B>&nbsp;Gp;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4.f</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>package</B>&nbsp;<B>body</B>&nbsp;Gp&nbsp;<B>is</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;NT2&nbsp;<B>is</B>&nbsp;<B>new</B>&nbsp;NT&nbsp;<B>with</B>&nbsp;<B>null</B>&nbsp;<B>record</B>;&nbsp;--<I>&nbsp;Illegal!</I><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<B>procedure</B>&nbsp;Q(X&nbsp;:&nbsp;<B>in</B>&nbsp;NT2)&nbsp;<B>is</B>&nbsp;<B>begin</B>&nbsp;<B>null</B>;&nbsp;<B>end</B>&nbsp;Q;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;--<I>&nbsp;Is&nbsp;this&nbsp;legal&nbsp;or&nbsp;not?&nbsp;Can't&nbsp;decide&nbsp;because</I><BR>
&nbsp;&nbsp;&nbsp;&nbsp;--<I>&nbsp;we&nbsp;don't&nbsp;know&nbsp;whether&nbsp;TT&nbsp;had&nbsp;any&nbsp;functions&nbsp;that&nbsp;go&nbsp;abstract</I><BR>
&nbsp;&nbsp;&nbsp;&nbsp;--<I>&nbsp;on&nbsp;extension.</I><BR>
<B>end</B>&nbsp;Gp;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4.g</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>package</B>&nbsp;I&nbsp;<B>is</B>&nbsp;<B>new</B>&nbsp;Gp(TT&nbsp;=&gt;&nbsp;P.T);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4.h</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>I.NT is an abstract type with
two abstract subprograms: F (inherited as abstract) and Q (explicitly
declared as abstract). But the generic body doesn't know about F, so
we don't know that it needs to be overridden to make a nonabstract extension
of NT. Furthermore, a formal tagged limited private type can be extended
with limited components, but the actual might not be limited, which would
allow assignment of limited types, which is bad. Hence, we have to disallow
this case as well.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4.i</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>If TT were declared as abstract,
then we could have the same problem with abstract procedures.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4.j</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>We considered disallowing all
tagged types in a generic body, for simplicity. We decided not to go
that far, in order to avoid unnecessary restrictions.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4.k</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><A NAME="I2086"></A>We also considered
trying make the accessibility level part of the contract; i.e. invent
some way of saying (in the <FONT FACE="Arial, Helvetica">generic_declaration</FONT>)
``all instances of this generic unit will have the same accessibility
level as the <FONT FACE="Arial, Helvetica">generic_declaration</FONT>.''
Unfortunately, that doesn't solve the part of the problem having to do
with abstract types.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4.l</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Children of generic units obviate
the need for extension in the body somewhat. </FONT></DIV>

<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I2087"></A>The elaboration of a <FONT FACE="Arial, Helvetica">record_extension_part</FONT>
consists of the elaboration of the <FONT FACE="Arial, Helvetica">record_definition</FONT>.
</DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>66&nbsp;&nbsp;The term ``type extension''
refers to a type as a whole. The term ``extension part'' refers to the
piece of text that defines the additional components (if any) the type
extension has relative to its specified ancestor type. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>We considered
other terminology, such as ``extended type.'' However, the terms ``private
extended type'' and ``record extended type'' did not convey the proper
meaning. Hence, we have chosen to uniformly use the term ``extension''
as the type resulting from extending a type, with ``private extension''
being one produced by privately extending the type, and ``record extension''
being one produced by extending the type with an additional record-like
set of components. Note also that the term ``type extension'' refers
to the result of extending a type in the language Oberon as well (though
there the term ``extended type'' is also used, interchangeably, perhaps
because Oberon doesn't have the concept of a ``private extension'').
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>67&nbsp;&nbsp;The accessibility rules
imply that a tagged type declared in a library <FONT FACE="Arial, Helvetica">package_specification</FONT>
can be extended only at library level or as a generic formal. When the
extension is declared immediately within a <FONT FACE="Arial, Helvetica">package_body</FONT>,
primitive subprograms are inherited and are overridable, but new primitive
subprograms cannot be added.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>68&nbsp;&nbsp;A <FONT FACE="Arial, Helvetica">name</FONT>
that denotes a component (including a discriminant) of the parent type
is not allowed within the <FONT FACE="Arial, Helvetica">record_extension_part</FONT>.
Similarly, a <FONT FACE="Arial, Helvetica">name</FONT> that denotes a
component defined within the <FONT FACE="Arial, Helvetica">record_extension_part</FONT>
is not allowed within the <FONT FACE="Arial, Helvetica">record_extension_part</FONT>.
It is permissible to use a <FONT FACE="Arial, Helvetica">name</FONT>
that denotes a discriminant of the record extension, providing there
is a new <FONT FACE="Arial, Helvetica">known_discriminant_part</FONT>
in the enclosing type declaration. (The full rule is given in <A HREF="AA-3-8.html">3.8</A>.)
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>The restriction
against depending on discriminants of the parent is to simplify the definition
of extension aggregates. The restriction against using parent components
in other ways is methodological; it presumably simplifies implementation
as well. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>69&nbsp;&nbsp;Each visible component
of a record extension has to have a unique name, whether the component
is (visibly) inherited from the parent type or declared in the <FONT FACE="Arial, Helvetica">record_extension_part</FONT>
(see <A HREF="AA-8-3.html">8.3</A>). </FONT></DIV>

<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;<I>Examples of
record extensions (of types defined above in <A HREF="AA-3-9.html">3.9</A>):</I>
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Painted_Point&nbsp;<B>is&nbsp;new</B>&nbsp;Point&nbsp;<B>with</B><BR>
&nbsp;&nbsp;<B>record</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;Paint&nbsp;:&nbsp;Color&nbsp;:=&nbsp;White;<BR>
&nbsp;&nbsp;<B>end&nbsp;record</B>;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I>--&nbsp;Components&nbsp;X&nbsp;and&nbsp;Y&nbsp;are&nbsp;inherited</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Examples"><TT>Origin&nbsp;:&nbsp;<B>constant</B>&nbsp;Painted_Point&nbsp;:=&nbsp;(X&nbsp;|&nbsp;Y&nbsp;=&gt;&nbsp;0.0,&nbsp;Paint&nbsp;=&gt;&nbsp;Black);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Literal&nbsp;<B>is&nbsp;new</B>&nbsp;Expression&nbsp;<B>with</B><BR>
&nbsp;&nbsp;<B>record</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>--&nbsp;a&nbsp;leaf&nbsp;in&nbsp;an&nbsp;Expression&nbsp;tree</I><BR>
&nbsp;&nbsp;&nbsp;&nbsp;Value&nbsp;:&nbsp;Real;<BR>
&nbsp;&nbsp;<B>end&nbsp;record</B>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Expr_Ptr&nbsp;<B>is&nbsp;access&nbsp;all</B>&nbsp;Expression'Class;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>--&nbsp;see&nbsp;<A HREF="AA-3-10.html">3.10</A></I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Binary_Operation&nbsp;<B>is&nbsp;new</B>&nbsp;Expression&nbsp;<B>with</B><BR>
&nbsp;&nbsp;<B>record</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>--&nbsp;an&nbsp;internal&nbsp;node&nbsp;in&nbsp;an&nbsp;Expression&nbsp;tree</I><BR>
&nbsp;&nbsp;&nbsp;&nbsp;Left,&nbsp;Right&nbsp;:&nbsp;Expr_Ptr;<BR>
&nbsp;&nbsp;<B>end&nbsp;record</B>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Addition&nbsp;<B>is&nbsp;new</B>&nbsp;Binary_Operation&nbsp;<B>with&nbsp;null&nbsp;record</B>;<BR>
<B>type</B>&nbsp;Subtraction&nbsp;<B>is&nbsp;new</B>&nbsp;Binary_Operation&nbsp;<B>with&nbsp;null&nbsp;record</B>;<BR>
&nbsp;&nbsp;<I>--&nbsp;No&nbsp;additional&nbsp;components&nbsp;needed&nbsp;for&nbsp;these&nbsp;extensions</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DIV Class="Examples"><TT>Tree&nbsp;:&nbsp;Expr_Ptr&nbsp;:=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>--&nbsp;A&nbsp;tree&nbsp;representation&nbsp;of&nbsp;``5.0&nbsp;+&nbsp;(13.0-7.0)''</I><BR>
&nbsp;&nbsp;&nbsp;<B>new</B>&nbsp;Addition'(<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Left&nbsp;&nbsp;=&gt;&nbsp;<B>new</B>&nbsp;Literal'(Value&nbsp;=&gt;&nbsp;5.0),<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Right&nbsp;=&gt;&nbsp;<B>new</B>&nbsp;Subtraction'(<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Left&nbsp;&nbsp;=&gt;&nbsp;<B>new</B>&nbsp;Literal'(Value&nbsp;=&gt;&nbsp;13.0),<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Right&nbsp;=&gt;&nbsp;<B>new</B>&nbsp;Literal'(Value&nbsp;=&gt;&nbsp;7.0)));</TT></DIV>

<H4 ALIGN=CENTER>Extensions to Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>17.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><A NAME="I2088"></A>Type extension
is a new concept. </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-9.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-3-9-2.html">Next</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>