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 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>AARM95 - Subprogram Renaming Declarations</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> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-8-5-3.html">Previous</A> <A HREF="AA-8-5-5.html">Next</A></P>
<HR>
<H1> 8.5.4 Subprogram Renaming Declarations</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal"> A <FONT FACE="Arial, Helvetica">subprogram_renaming_declaration</FONT>
can serve as the completion of a <FONT FACE="Arial, Helvetica">subprogram_declaration</FONT>;
<A NAME="I3411"></A>such a <FONT FACE="Arial, Helvetica">renaming_declaration</FONT>
is called a <I>renaming-as-body</I>. <A NAME="I3412"></A>A <FONT FACE="Arial, Helvetica">subprogram_renaming_declaration</FONT>
that is not a completion is called a <I>renaming-as-declaration</I>[,
and is used to rename a subprogram (possibly an enumeration literal)
or an entry]. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>1.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>A renaming-as-body
is a declaration, as defined in Section 3. </FONT></DIV>
<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">subprogram_renaming_declaration<A NAME="I3413"></A>
::= </FONT><A NAME="I3414"></A><FONT FACE="Arial, Helvetica">subprogram_specification</FONT> <B>renames</B> <I>callable_entity_</I><A NAME="I3415"></A><FONT FACE="Arial, Helvetica">name</FONT>;</DIV>
<H4 ALIGN=CENTER>Name Resolution Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="Normal"> <A NAME="I3416"></A>The expected profile for the
<I>callable_entity_</I><FONT FACE="Arial, Helvetica">name</FONT> is the
profile given in the <FONT FACE="Arial, Helvetica">subprogram_specification</FONT>.
</DIV>
<H4 ALIGN=CENTER>Legality Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="Normal"> The profile of a renaming-as-declaration shall
be mode-conformant with that of the renamed callable entity. <A NAME="I3417"></A></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0027">8652/0027</A></I>}
{<I><A HREF="defect1.html#8652/0028">8652/0028</A></I>} The profile of
a renaming-as-body <S>shall be subtype-conformant with that of the renamed
callable entity, and </S>shall conform fully to that of the declaration
it completes. <A NAME="I3418"></A>If the renaming-as-body completes that
declaration before the subprogram it declares is frozen, <U>the profile
shall be mode-conformant <A NAME="I3419"></A>with that of the renamed
callable entity and </U>the subprogram it declares takes its convention
from the renamed subprogram; otherwise<U>, the profile shall be subtype-conformant
with that of the renamed callable entity and</U> the convention of the
renamed subprogram shall not be Intrinsic. <A NAME="I3420"></A><U>A renaming-as-body
is illegal if the declaration occurs before the subprogram whose declaration
it completes is frozen, and the renaming renames the subprogram itself,
through one or more subprogram renaming declarations, none of whose subprograms
has been frozen.</U> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.a/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>The <U>otherwise
part of the second sentence</U><S>first part of the first sentence</S>
is to allow an implementation of a renaming-as-body as a single jump
instruction to the target subprogram. Among other things, this prevents
a subprogram from being completed with a renaming of an entry. (In most
cases, the target of the jump can be filled in at link time. In some
cases, such as a renaming of a name like "A(I).<B>all</B>",
an indirect jump is needed. Note that the name is evaluated at renaming
time, not at call time.)</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.a.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>{<I><A HREF="defect1.html#8652/0028">8652/0028</A></I>}
<U>The first part of the second sentence is intended to allow renaming-as-body
of predefined operators before the <FONT FACE="Arial, Helvetica">subprogram_declaration</FONT>
is frozen. For some types (such as integer types), the parameter type
for operators is the base type, and it would be very strange for<BR>
<TT> <B>function</B> Equal (A, B : <B>in</B> T) <B>return</B>
Boolean;</TT><BR>
<TT> <B>function</B> Equal (A, B : <B>in</B> T) <B>return</B>
Boolean <B>renames</B> "=";</TT><BR>
to be illegal. (Note that predefined operators cannot be renamed this
way after the <FONT FACE="Arial, Helvetica">subprogram_declaration</FONT>
is frozen, as they have convention Intrinsic.)</U></FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.b/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The <S>second part of the </S>first
sentence is the normal rule for completions of <FONT FACE="Arial, Helvetica">subprogram_declaration</FONT>s.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>An <FONT FACE="Arial, Helvetica">entry_declaration</FONT>,
unlike a <FONT FACE="Arial, Helvetica">subprogram_declaration</FONT>,
cannot be completed with a <FONT FACE="Arial, Helvetica">renaming_declaration</FONT>.
Nor can a <FONT FACE="Arial, Helvetica">generic_subprogram_declaration</FONT>.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The syntax rules prevent a protected
subprogram declaration from being completed by a renaming. This is fortunate,
because it allows us to avoid worrying about whether the implicit protected
object parameter of a protected operation is involved in the conformance
rules. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.d.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>{<I><A HREF="defect1.html#8652/0027">8652/0027</A></I>}
<U>Circular renames before freezing is illegal, as the compiler would
not be able to determine the convention of the subprogram. Other circular
renames are handled below; see Bounded (Run-Time) Errors.</U> </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Normal"> A <FONT FACE="Arial, Helvetica">name</FONT> that
denotes a formal parameter of the <FONT FACE="Arial, Helvetica">subprogram_specification</FONT>
is not allowed within the <I>callable_entity_</I><FONT FACE="Arial, Helvetica">name</FONT>.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.a</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1><B>Reason:
</B>This is to prevent things like this: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.b</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>function</B> F(X : Integer) <B>return</B> Integer <B>renames</B> Table(X).<B>all</B>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.c</FONT></DIV>
<DIV Class="WideAnnotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1>A
similar rule in <A HREF="AA-6-1.html">6.1</A> forbids things like this:
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.d</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>function</B> F(X : Integer; Y : Integer := X) <B>return</B> Integer;</TT></DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Normal"> A renaming-as-declaration declares a new view
of the renamed entity. The profile of this new view takes its subtypes,
parameter modes, and calling convention from the original profile of
the callable entity, while taking the formal parameter <FONT FACE="Arial, Helvetica">name</FONT>s
and <FONT FACE="Arial, Helvetica">default_expression</FONT>s from the
profile given in the <FONT FACE="Arial, Helvetica">subprogram_renaming_declaration</FONT>.
The new view is a function or procedure, never an entry. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B>When renaming
an entry as a procedure, the compile-time rules apply as if the new view
is a procedure, but the run-time semantics of a call are that of an entry
call. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>For example,
it is illegal for the <FONT FACE="Arial, Helvetica">entry_call_statement</FONT>
of a <FONT FACE="Arial, Helvetica">timed_entry_call</FONT> to call the
new view. But what looks like a procedure call will do things like barrier
waiting.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.b.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>{<I><A HREF="defect2.html#8652/0105">8652/0105</A></I>}
<U>All properties of the renamed entity are inherited by the new view
unless otherwise stated by this International Standard. In particular,
if the renamed entity is abstract or requires overridding (see <A HREF="AA-3-9-3.html">3.9.3</A>),
the new view also is abstract or requires overridding. (The renaming
will often be illegal in these cases, as a renaming cannot be overridden.)</U>
</FONT></DIV>
<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>7.1/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0014">8652/0014</A></I>}
<U>For a call to a subprogram whose body is given as a renaming-as-body,
the execution of the renaming-as-body is equivalent to the execution
of a <FONT FACE="Arial, Helvetica">subprogram_body</FONT> that simply
calls the renamed subprogram with its formal parameters as the actual
parameters and, if it is a function, returns the value of the call.</U>
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.b.2/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B><U>This implies
that the subprogram completed by the renames-as-body has its own elaboration
check.</U> </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Normal"> For a call on a renaming of a dispatching subprogram
that is overridden, if the overriding occurred before the renaming, then
the body executed is that of the overriding declaration, even if the
overriding declaration is not visible at the place of the renaming; otherwise,
the inherited or predefined subprogram is called. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>Note that whether
or not the renaming is itself primitive has nothing to do with the renamed
subprogram.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Note that the above rule is only
for tagged types.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.c</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1>Consider
the following example: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.d</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>package</B> P <B>is</B><BR>
<B>type</B> T <B>is</B> <B>tagged</B> <B>null</B> <B>record</B>;<BR>
<B>function</B> Predefined_Equal(X, Y : T) <B>return</B> Boolean <B>renames</B> "=";<BR>
<B>private</B><BR>
<B>function</B> "="(X, Y : T) <B>return</B> Boolean; --<I> Override predefined "=".</I><BR>
<B>end</B> P;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.e</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>with</B> P; <B>use</B> P;<BR>
<B>package</B> Q <B>is</B><BR>
<B>function</B> User_Defined_Equal(X, Y : T) <B>return</B> Boolean <B>renames</B> P."=";<BR>
<B>end</B> Q;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.f</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>A call on Predefined_Equal will
execute the predefined equality operator of T, whereas a call on User_Defined_Equal
will execute the body of the overriding declaration in the private part
of P.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.g</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Thus a renaming allows one to
squirrel away a copy of an inherited or predefined subprogram before
later overriding it. </FONT></DIV>
<H4 ALIGN=CENTER>Bounded (Run-Time) Errors</H4>
<DIV Class="Paranum"><FONT SIZE=-2>8.1/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0027">8652/0027</A></I>}
<U><A NAME="I3421"></A><A NAME="I3422"></A>If a subprogram directly or
indirectly renames itself, then it is a bounded error to call that subprogram.
Possible consequences are that Program_Error or Storage_Error is raised,
or that the call results in infinite recursion.</U> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.g.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>{<I><A HREF="defect1.html#8652/0027">8652/0027</A></I>}
<U>This has to be a bounded error, as it is possible for a renames-as-body
appearing in a package body to cause this problem. Thus it is not possible
in general to detect this problem at compile time.</U> </FONT></DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>11 A procedure can only be
renamed as a procedure. A function whose <FONT FACE="Arial, Helvetica">defining_designator</FONT>
is either an <FONT FACE="Arial, Helvetica">identifier</FONT> or an <FONT FACE="Arial, Helvetica">operator_symbol</FONT>
can be renamed with either an <FONT FACE="Arial, Helvetica">identifier</FONT>
or an <FONT FACE="Arial, Helvetica">operator_symbol</FONT>; for renaming
as an operator, the subprogram specification given in the <FONT FACE="Arial, Helvetica">renaming_declaration</FONT>
is subject to the rules given in <A HREF="AA-6-6.html">6.6</A> for operator
declarations. Enumeration literals can be renamed as functions; similarly,
<FONT FACE="Arial, Helvetica">attribute_reference</FONT>s that denote
functions (such as references to Succ and Pred) can be renamed as functions.
An entry can only be renamed as a procedure; the new <FONT FACE="Arial, Helvetica">name</FONT>
is only allowed to appear in contexts that allow a procedure <FONT FACE="Arial, Helvetica">name</FONT>.
An entry of a family can be renamed, but an entry family cannot be renamed
as a whole.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>12 The operators of the root
numeric types cannot be renamed because the types in the profile are
anonymous, so the corresponding specifications cannot be written; the
same holds for certain attributes, such as Pos.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>13 Calls with the new <FONT FACE="Arial, Helvetica">name</FONT>
of a renamed entry are <FONT FACE="Arial, Helvetica">procedure_call_statement</FONT>s
and are not allowed at places where the syntax requires an <FONT FACE="Arial, Helvetica">entry_call_statement</FONT>
in <FONT FACE="Arial, Helvetica">conditional_</FONT> and <FONT FACE="Arial, Helvetica">timed_entry_call</FONT>s,
nor in an <FONT FACE="Arial, Helvetica">asynchronous_select</FONT>; similarly,
the Count attribute is not available for the new <FONT FACE="Arial, Helvetica">name</FONT>.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>14 The primitiveness of a
renaming-as-declaration is determined by its profile, and by where it
occurs, as for any declaration of (a view of) a subprogram; primitiveness
is not determined by the renamed view. In order to perform a dispatching
call, the subprogram name has to denote a primitive subprogram, not a
non-primitive renaming of a primitive subprogram. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>A <FONT FACE="Arial, Helvetica">subprogram_renaming_declaration</FONT>
could more properly be called <FONT FACE="Arial, Helvetica">renaming_as_subprogram_declaration</FONT>,
since you're renaming something as a subprogram, but you're not necessarily
renaming a subprogram. But that's too much of a mouthful. Or, alternatively,
we could call it a <FONT FACE="Arial, Helvetica">callable_entity_renaming_declaration</FONT>,
but that's even worse. Not only is it a mouthful, it emphasizes the entity
being renamed, rather than the new view, which we think is a bad idea.
We'll live with the oddity. </FONT></DIV>
<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <I>Examples of
subprogram renaming declarations:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DIV Class="Examples"><TT><B>procedure</B> My_Write(C : <B>in</B> Character) <B>renames</B> Pool(K).Write; --<I> see <A HREF="AA-4-1-3.html">4.1.3</A></I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Real_Plus(Left, Right : Real ) <B>return</B> Real <B>renames</B> "+";<BR>
<B>function</B> Int_Plus (Left, Right : Integer) <B>return</B> Integer <B>renames</B> "+";</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Rouge <B>return</B> Color <B>renames</B> Red; --<I> see <A HREF="AA-3-5-1.html">3.5.1</A></I><BR>
<B>function</B> Rot <B>return</B> Color <B>renames</B> Red;<BR>
<B>function</B> Rosso <B>return</B> Color <B>renames</B> Rouge;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Next(X : Color) <B>return</B> Color <B>renames</B> Color'Succ; --<I> see <A HREF="AA-3-5-1.html">3.5.1</A></I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DIV Class="Wide" Style="margin-bottom: 0.4em"> <I>Example of a subprogram
renaming declaration with new parameter names:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> "*" (X,Y : Vector) <B>return</B> Real <B>renames</B> Dot_Product; --<I> see <A HREF="AA-6-1.html">6.1</A></I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="Wide" Style="margin-bottom: 0.4em"> <I>Example of a subprogram
renaming declaration with a new default expression:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Minimum(L : Link := Head) <B>return</B> Cell <B>renames</B> Min_Cell; --<I> see <A HREF="AA-6-1.html">6.1</A></I></TT></DIV>
<HR>
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-8-5-3.html">Previous</A> <A HREF="AA-8-5-5.html">Next</A> <A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>
|