CVS difference for ai22s/ai22-0036-1.html

Differences between 1.4 and version 1.5
Log of other versions for file ai22s/ai22-0036-1.html

--- ai22s/ai22-0036-1.html	2022/11/17 06:38:54	1.4
+++ ai22s/ai22-0036-1.html	2023/01/10 08:04:23	1.5
@@ -1,14 +1,15 @@
-<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><title>13.14(10/5)</title>
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><title>13.14(4/1)</title>
 <style type="text/css">
 table td,table th{padding:0}
-.c11{border-right-style:solid;padding:5pt 5pt 5pt 5pt;border-bottom-color:#000000;border-top-width:0pt;border-right-width:0pt;border-left-color:#000000;vertical-align:top;border-right-color:#000000;border-left-width:0pt;border-top-style:solid;background-c
olor:#f0f0f0;border-left-style:solid;border-bottom-width:0pt;width:468pt;border-top-color:#000000;border-bottom-style:solid}
-.c18{border-spacing:0;border-collapse:collapse;margin-right:auto}
-.c17{background-color:#ffffff;max-width:468pt;padding:72pt 72pt 72pt 72pt}
-.c20{height:0pt}
+.c13{border-right-style:solid;padding:5pt 5pt 5pt 5pt;border-bottom-color:#000000;border-top-width:0pt;border-right-width:0pt;border-left-color:#000000;vertical-align:top;border-right-color:#000000;border-left-width:0pt;border-top-style:solid;background-c
olor:#f0f0f0;border-left-style:solid;border-bottom-width:0pt;width:468pt;border-top-color:#000000;border-bottom-style:solid}
+.c26{border-spacing:0;border-collapse:collapse;margin-right:auto}
+.c18{background-color:#ffffff;max-width:468pt;padding:72pt 72pt 72pt 72pt}
+.c5{height:0pt}
 P.head{margin-bottom:0; margin-top:0; margin-left:0; margin-right:0; padding-top:0pt; color:#000000; font-size:14pt; padding-bottom:0pt; font-family:"Arial","Liberation Sans",sans-serif; line-height:1.15; orphans:2; widows:2; text-align:left; font-weight:
400; text-decoration:none; vertical-align:baseline; font-style:normal}
 H2.head{margin-bottom:0; margin-top:0; margin-left:0; margin-right:0; padding-top:12pt; color:#000000; font-size:14pt; padding-bottom:6pt; font-family:"Arial","Liberation Sans",sans-serif; line-height:1.15; page-break-after:avoid; orphans:2; widows:2; tex
t-align:left; font-weight:400; text-decoration:none; vertical-align:baseline; font-style:normal}
 P.inst{margin-bottom:0; margin-top:0; margin-left:18pt; margin-right:0; padding-top:9pt; color:#000000; font-size:12pt; padding-bottom:6pt; font-family:"Arial","Liberation Sans",sans-serif;line-height:1.15; orphans:2; widows:2; text-align:left; font-weigh
t:400; text-decoration:none; vertical-align:baseline; font-style:normal}
 P.word{margin-bottom:0; margin-top:0; margin-left:36pt; margin-right:0; padding-top:0pt; color:#000000; font-size:11pt; padding-bottom:3pt; font-family:"Times New Roman","Times",serif; line-height:1.15; orphans:2; widows:2; text-align:left; font-weight:40
0; text-decoration:none; vertical-align:baseline; font-style:normal}
+P.wrds{margin-bottom:0; margin-top:0; margin-left:36pt; margin-right:0; padding-top:0pt; color:#000000; font-size:11pt; padding-bottom:12pt; font-family:"Times New Roman","Times",serif; line-height:1.15; orphans:2; widows:2; text-align:left; font-weight:4
00; text-decoration:none; vertical-align:baseline; font-style:normal}
 UL.wbl{margin-bottom:0; margin-top:0; margin-left:42pt; margin-right:0; padding-top:0pt; color:#000000; font-size:11pt; padding-bottom:3pt; font-family:"Times New Roman","Times",serif; line-height:1.15; orphans:2; widows:2; text-align:left; font-weight:40
0; text-decoration:none; vertical-align:baseline; font-style:normal; list-style: disc outside}
 P.wind{margin-bottom:0; margin-top:0; margin-left:54pt; margin-right:0; padding-top:0pt; color:#000000; font-size:11pt; padding-bottom:3pt; font-family:"Times New Roman","Times",serif; line-height:1.15; orphans:2; widows:2; text-align:left; font-weight:40
0; text-decoration:none; vertical-align:baseline; font-style:normal}
 P.codt{margin-bottom:0; margin-top:0; margin-left:0; margin-right:0; padding-top:0pt; color:#000000; font-size:10pt; padding-bottom:0pt; font-family:"Courier New",monospace; line-height:1.15; text-align:left; background-color:#f0f0f0; font-weight:400; tex
t-decoration:none; vertical-align:baseline; font-style:normal}
@@ -17,13 +18,20 @@
 P.from{margin-bottom:0; margin-top:0; margin-left:0; margin-right:0; padding-top:0pt; color:#000000; font-size:10pt; padding-bottom:0pt; font-family:"Arial","Liberation Sans",sans-serif; line-height:1.15; orphans:2; widows:2; text-align:left; font-weight:
400; text-decoration:none; vertical-align:baseline; font-style:none}
 P.time{margin-bottom:0; margin-top:0; margin-left:0; margin-right:0; padding-top:0pt; color:#000000; font-size:9pt; padding-bottom:9pt; font-family:"Arial","Liberation Sans",sans-serif; line-height:1.15; orphans:2; widows:2; text-align:left; font-weight:4
00; text-decoration:none; vertical-align:baseline; font-style:italic}
 SPAN.name{font-family:"Lucida Calligraphy",cursive; font-style:normal}
+SPAN.ins{color:#008800}
+SPAN.del{color:#880000}
 SPAN.ntrm{font-family:"Arial","Liberation Sans",sans-serif}
-P.a2{margin-bottom:0; margin-top:0; margin-left:0; margin-right:0;color:#000000;font-size:26pt;font-family:"Arial","Liberation Sans",sans-serif; padding-top:0pt; padding-bottom:3pt; line-height:1.1500000000000001; page-break-after:avoid; orphans:2; widows
:2; text-align:left; font-weight:400; text-decoration:none; vertical-align:baseline; font-style:normal}
+P.a3{margin-bottom:0; margin-top:0; margin-left:0; margin-right:0;color:#000000;font-size:26pt;font-family:"Arial","Liberation Sans",sans-serif; padding-top:0pt; padding-bottom:3pt; line-height:1.1500000000000001; page-break-after:avoid; orphans:2; widows
:2; text-align:left; font-weight:400; text-decoration:none; vertical-align:baseline; font-style:normal}
 </style>
-</head><body class="c17 doc-content"><p class="a2">AI22-0036-1</p>
+</head><body class="c18 doc-content"><p class="a3">AI22-0036-1</p>
 <p class="head">!standard 8.6(17/3)&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 22-11-10 &nbsp;AI22-0036-1/05</p>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 22-12-29 &nbsp;AI22-0036-1/06</p>
+<p class="head">!standard 13.14(4/1)</p>
+<p class="head">!standard 13.14(7.2/5)</p>
+<p class="head">!standard 13.14(8/4)</p>
+<p class="head">!standard 13.14(8.2/1)</p>
 <p class="head">!standard 13.14(10/5)</p>
+<p class="head">!standard 13.14(15.2/5)</p>
 <p class="head">!class binding interpretation 22-01-26</p>
 <p class="head">!status work item 22-01-26</p>
 <p class="head">!status received 21-04-28</p>
@@ -33,21 +41,23 @@
 <p class="head">!subject Attributes in the expression of Default_Value</p>
 <h2 class="head">!summary</h2>
 <p class="txts">The attributes First, Last, Val, and Pos can be used in the expression of a
-Default_Value aspect specification.</p>
+Default_Value aspect specification, as can an enumeration literal. &nbsp;This requires changes to
+the freezing rules, which we reorganize to clarify the distinction between what constructs
+&nbsp;&quot;cause freezing&quot; and what entities are &quot;frozen&quot; when used in a construct
+that causes freezing.</p>
 
 <p class="text">The &ldquo;current instance&rdquo; rule does not apply when the name of a type is
 used as the prefix of an attribute within the expression of a Default_Value aspect specification
 and the prefix of the attribute is expected to be a type or subtype, not an object.</p>
 <h2 class="head">!issue</h2>
-
 <p class="txts">If one wants to create a Character type for which the default value is the NUL
 character, (Ada.Characters.Latin_1.Nul), there does not appear to be any legal way to do it. One
 needs some sort of conversion of the Nul value (since it is not an enumeration literal of the type,
 so it is not inherited), but all such conversions are illegal.</p>
 
 <p class="text">For instance:</p>
-<a id="t.93cdc93f7933f0879b1b6e02881eb544af0506d7"></a><a id="t.0"></a><table class="c18"></table><p class="text">&nbsp;</p>
-<a id="t.95917217e1d5f0ad5def57a7c4bf5b8bfff0930c"></a><a id="t.1"></a><table class="c18"><tr class="c20"><td class="c11">
+<a id="t.93cdc93f7933f0879b1b6e02881eb544af0506d7"></a><a id="t.0"></a><table class="c26"></table><p class="text">&nbsp;</p>
+<a id="t.95917217e1d5f0ad5def57a7c4bf5b8bfff0930c"></a><a id="t.1"></a><table class="c26"><tr class="c5"><td class="c13">
 <p class="codt">&nbsp; <b>type</b> Char <b>is</b> <b>new</b> Character &nbsp;<br>
  &nbsp; &nbsp; <b>with</b> Default_Value =&gt; Char (Ada.Characters.Latin_1.Nul);</p>
 </td></tr></table><p class="text">&nbsp;</p>
@@ -76,27 +86,133 @@
 <p class="wind">AARM Discussion: Language-defined scalar subtype attributes that might be used here
 include First, Last, Val, and Pos. Enum_Val and Enum_Rep could not be used as they would freeze the
 type.</p>
-<p class="inst">Replace 13.14(10/5):</p>
-<p class="word">At the place where an <span class="ntrm">expression</span> causes freezing, the
-type of the expression is frozen, unless the <span class="ntrm">expression</span> is an enumeration
-literal used as a <span class="ntrm">discrete_choice</span> of the
-<span class="ntrm">array_aggregate</span> of an
-<span class="ntrm">enumeration_representation_clause</span> or as the
-<span class="ntrm">aspect_definition</span> of a specification for aspect Default_Value.</p>
-<p class="inst">with</p>
-<p class="word">At the place where an expression causes freezing, the type of the expression is
-frozen, unless either:</p>
-<ul class="wbl"><li>the expression is an enumeration literal used as a discrete_choice of the
-array_aggregate of an enumeration_representation_clause; or</li>
-<li>the expression is the <span class="ntrm">aspect_definition</span> of a specification for the
-aspect Default_Value and the expression is either an enumeration literal or an
-<span class="ntrm">attribute_reference</span> whose attribute designator is First, Last, Val, Pos,
-or Range.</li>
+<p class="inst">Modify and reorder 13.14, starting at (4/1) and continuing through (15.3/5)):</p>
+
+<p class="word">A construct that (explicitly or implicitly) references an entity can cause the
+<i>freezing </i>of the entity, as defined by subsequent paragraphs. At the place where a construct
+causes freezing, each <span class="ntrm">name</span>, <span class="ntrm">expression</span>,
+<span class="ntrm">implicit_dereference</span>, or <span class="ntrm">range</span> within the
+construct causes freezing<span class="ins">{, except as defined below}</span>:</p>
+<ul class="wbl"><li>The occurrence of a <span class="ntrm">generic_instantiation </span>causes
+freezing, except that a <span class="ntrm">name</span> which is a generic actual parameter whose
+corresponding generic formal parameter is a formal incomplete type (see 12.5.1) does not cause
+freezing. In addition, if a parameter of the instantiation is defaulted, the
+<span class="ntrm">default_expression</span> or <span class="ntrm">default_name</span> for that
+parameter causes freezing.</li>
+<li>At the occurrence of an <span class="ntrm">expression_function_declaration</span> that is a
+completion, the return expression of the expression function causes freezing.</li>
+<li>At the occurrence of a renames-as-body whose
+<i>callable_entity_</i><span class="ntrm">name</span> denotes an expression function, the return
+expression of the expression function causes freezing.</li>
+<li>The occurrence of an <span class="ntrm">object_declaration</span> that has no corresponding
+completion causes freezing. </li>
+<li>The declaration of a record extension causes freezing of the parent subtype. </li>
+<li>The declaration of a record extension, interface type, task unit, or protected unit causes
+freezing of any progenitor types specified in the declaration. </li>
+<li>&lt;&lt;Was (8/4)&gt;&gt;A static expression <span class="del">[(other than within an
+<span class="ntrm">aspect_specification</span>)]</span> causes freezing where it
+occurs<span class="ins">{ with the following exceptions:}</span></li>
+<ul class="wbl"><li><span class="ins">{Any freezing caused by a static expression occurring within
+an <span class="ntrm">aspect_specification</span> is postponed at least until the
+<span class="ntrm">aspect_specification</span> is resolved (see below);</span></li>
+<li><span class="ins">An enumeration literal used as a <span class="ntrm">discrete_choice</span> of
+the <span class="ntrm">array_aggregate</span> of an
+<span class="ntrm">enumeration_representation_clause </span>does not cause freezing}</span>.</li>
 </ul>
-<p class="wind">AARM Reason: The attributes allowed in a Default_Value expression are those that
-only depend on the position number. The position number is determined solely by the syntax and
-static expressions that make up the type definition, and thus can be determined for an unfrozen
-type.</p>
+<li>&lt;&lt;Was second half of (8/4)&gt;&gt;An object name or nonstatic expression
+causes freezing where it occurs, unless the name or expression is part of a
+<span class="ntrm">default_expression</span>, a <span class="ntrm">default_name,</span> the return
+expression of an expression function, an <span class="ntrm">aspect_specification</span>, or a
+per-object expression of a component&#39;s constraint, in which case, the freezing occurs later as
+part of another construct or at the freezing point of an associated entity.</li>
+<li>&lt;&lt;Was (7.2/5)&gt;&gt;At the freezing point of the entity associated with an
+<span class="ntrm">aspect_specification</span>, any <span class="del">[static expressions within
+the <span class="ntrm">aspect_specification</span> cause freezing, as do]</span>
+<span class="ins">{nonstatic}</span> <span class="ntrm">expression</span>s or
+<span class="ntrm">name</span>s in <span class="ntrm">aspect_definition</span>s
+<span class="ins">{cause freezing both}</span> for representation aspects,
+<span class="del">[or]</span><span class="ins">{and for}</span> operational aspects that have a
+corresponding operational attribute. Similarly, if an <span class="ntrm">aspect_definition</span>
+for an operational aspect, other than an assertion aspect, can affect the Name Resolution, Static
+Semantics, or Legality Rules of a subsequent construct, then any
+<span class="ins">{nonstatic}</span> <span class="ntrm">expression</span>s or
+<span class="ntrm">name</span>s within the <span class="ntrm">aspect_definition</span> cause
+freezing at the freezing point of the associated entity. &lt;&lt;Was part of (7.2/5)&gt;&gt; For
+the purposes of this rule, if there is no declared entity associated with an
+<span class="ntrm">aspect_specification</span>, the freezing point is considered to occur
+immediately following the <span class="ntrm">aspect_specification</span>.</li>
+<li>&lt;&lt;Was part of (7.2/5)&gt;&gt;Any static expressions within an
+<span class="ntrm">aspect_specification</span> <span class="del">[also]</span> cause
+freezing<span class="ins">{ both at the freezing point of the entity associated with the
+<span class="ntrm">aspect_specification</span>, and}</span> at the end of the immediately enclosing
+declaration list<span class="ins">{, with the following exceptions:}</span></li>
+<ul class="wbl"><li><span class="ins">{static expressions of the form S&#39;First, S&#39;Last,
+S&#39;Val(...), or S&#39;Pos(...) and static ranges of the form S&#39;Range do not cause freezing
+if they occur within an <span class="ntrm">aspect_defintion</span> for the Default_Value aspect of
+a type <i>T</i>, where S is a static subtype of <i>T</i>;</span></li>
+<li><span class="ins">an enumeration literal does not cause freezing if it occurs within an
+<span class="ntrm">aspect_definition</span> for the Default_Value aspect of its type}</span>.</li>
+</ul>
+<li>&lt;&lt;Was (15.2/5&gt;&gt;At the place where a construct causes freezing, if
+the construct includes a check associated with some assertion aspect (independent of whether the
+check is enabled), or depends on the definition of some operational aspect as part of its Dynamic
+Semantics, any names or expressions in the <span class="ntrm">aspect_definition</span> for the
+aspect cause freezing.</li>
+</ul>
+<p class="wrds">An implicit call freezes the same entities and profiles that would be frozen by an
+explicit call. This is true even if the implicit call is removed via implementation
+permissions.</p>
+
+<p class="word">The following rules define which entities are frozen at the place where a construct
+causes freezing: </p>
+<ul class="wbl"><li>At the place where an expression causes freezing, the type of the expression is
+frozen<span class="del">[, unless the expression is an enumeration literal used as a
+<span class="ntrm">discrete_choice</span> of the <span class="ntrm">array_aggregate</span> of an
+<span class="ntrm">enumeration_representation_clause </span>or as the
+<span class="ntrm">aspect_definition</span> of a specification for aspect Default_Value]</span>.
+</li>
+<li>&lt;&lt;Was (8.2/1)&gt;&gt;If an expression is implicitly converted to a type or subtype
+<i>T,</i> then at the place where the expression causes freezing, <i>T</i> is frozen.</li>
+<li>At the place where a function call causes freezing, the profile of the function is frozen.
+Furthermore, if a parameter of the call is defaulted, the
+<span class="ntrm">default_expression</span> for that parameter causes freezing. If the function
+call is to an expression function, the return expression of the expression function causes
+freezing.</li>
+<li>At the place where a <span class="ntrm">generic_instantiation</span> causes freezing of a
+callable entity, the profile of that entity is frozen unless the formal subprogram corresponding to
+the callable entity has a parameter or result of a formal untagged incomplete type; if the callable
+entity is an expression function, the return expression of the expression function causes
+freezing.</li>
+<li>At the place where a use of the Access or Unchecked_Access attribute whose
+<span class="ntrm">prefix</span> denotes an expression function causes freezing, the return
+expression of the expression function causes freezing.</li>
+<li>At the place where a <span class="ntrm">name</span> causes freezing, the entity denoted by the
+<span class="ntrm">name</span> is frozen, unless the <span class="ntrm">name</span> is a
+<span class="ntrm">prefix</span> of an expanded name; at the place where an object
+<span class="ntrm">name</span> causes freezing, the nominal subtype associated with the name is
+frozen. </li>
+<li>At the place where an <span class="ntrm">implicit_dereference</span> causes freezing, the
+nominal subtype associated with the <span class="ntrm">implicit_dereference</span> is frozen.</li>
+<li>At the place where a <span class="ntrm">range</span> causes freezing, the type of the
+<span class="ntrm">range</span> is frozen. </li>
+<li>At the place where an <span class="ntrm">allocator</span> causes freezing, the designated
+subtype of its type is frozen. If the type of the <span class="ntrm">allocator</span> is a derived
+type, then all ancestor types are also frozen. </li>
+<li>At the place where a profile is frozen, each subtype of the profile is frozen. If the
+corresponding callable entity is a member of an entry family, the index subtype of the family is
+frozen. </li>
+<li>At the place where a subtype is frozen, its type is frozen. At the place where a type is
+frozen, any expressions or names within the full type definition cause freezing, other than those
+that occur within an access_type_definition or an access_definition; the first subtype, and any
+component subtypes, index subtypes, and parent subtype of the type are frozen as well. For a
+specific tagged type, the corresponding class-wide type is frozen as well. For a class-wide type,
+the corresponding specific type is frozen as well. </li>
+<li>At the place where a specific tagged type is frozen, the primitive subprograms of the type are
+frozen. At the place where a type is frozen, any subprogram named in an
+<span class="ntrm">attribute_definition_clause</span> for the type is frozen. </li>
+</ul>
+<p class="word">&nbsp;Notwithstanding the rest of this subclause, freezing an incomplete view has
+no effect.</p>
 <h2 class="head">!discussion</h2>
 <p class="text">It might seem at first that the current instance change would open the door for
 freezing</p>
@@ -104,7 +220,7 @@
 typically not the case because of the possibility of bypassing the current instance rule by means
 of a partial view and a subtype, as in</p>
 <p class="text">&nbsp; </p>
-<a id="t.c711c9e162ca63b8a855ee8735fafaf3f57c4794"></a><a id="t.2"></a><table class="c18"><tr class="c20"><td class="c11">
+<a id="t.c711c9e162ca63b8a855ee8735fafaf3f57c4794"></a><a id="t.2"></a><table class="c26"><tr class="c5"><td class="c13">
 <p class="codt">&nbsp; &nbsp; &nbsp; <b>type</b> T <b>is</b> <b>private</b>;<br>
  &nbsp; <b>private</b><br>
  &nbsp; &nbsp; &nbsp;<b>subtype</b> S <b>is</b> T;<br>
@@ -124,14 +240,24 @@
 it is safe to allow Pos and Val in such contexts. Similarly, the values for First and Last are
 determined by the type&rsquo;s definition.</p>
 
-<p class="text">We make the &ldquo;hole&rdquo; as small as possible, so we only allow those
+<p class="txts">We make the &ldquo;hole&rdquo; as small as possible, so we only allow those
 attributes (and the equivalent Range) and only in the expression of Default_Value. Having
 attributes that do not freeze could cause issues (either semantically or of implementation) in
 other contexts, and there is no obvious additional expressivity in allowing them.</p>
+
+<p class="text">In general we considered two ways of creating &quot;holes&quot; in the freezing
+rules. &nbsp;One is to say that certain entities are not frozen even though they are used in a
+construct that causes freezing. &nbsp;The alternative is to say that certain constructs do not
+cause freezing, so it doesn&#39;t matter what entities they use, since no freezing is caused by the
+construct. &nbsp;After trying both ways, we settled on specifying that certain (parts of)
+constructs do <i>not</i> cause freezing. &nbsp;This was simpler because constructs like
+S&#39;Pos(...) can reference multiple entities, and we didn&#39;t want to have to add special cases
+for each such entity. &nbsp;Instead, we simply said that when such expressions appear as part of a
+static expression within a certain context, they do not cause freezing.</p>
 <h2 class="head">!example</h2>
 <p class="txts">This AI would allow the following declarations to be legal:</p>
 
-<a id="t.2ca453b052ff6b219ea9a7573dda84b3aee67fc7"></a><a id="t.3"></a><table class="c18"><tr class="c20"><td class="c11">
+<a id="t.2ca453b052ff6b219ea9a7573dda84b3aee67fc7"></a><a id="t.3"></a><table class="c26"><tr class="c5"><td class="c13">
 <p class="codt">Nul_Pos : <b>constant</b> Integer := <br>
  &nbsp; &nbsp;Character&#39;Pos (Ada.Characters.Latin_1.NUL); &nbsp; -- &nbsp;equals 0<br>
  &nbsp; <br>

Questions? Ask the ACAA Technical Agent