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

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

--- ai22s/ai22-0036-1.html	2022/09/03 05:35:45	1.2
+++ ai22s/ai22-0036-1.html	2022/11/06 19:19:55	1.3
@@ -1,29 +1,28 @@
-<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><title>AI22-0036-1/03</title>
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><title>AI22-0036-1/04</title>
 <style type="text/css">
 table td,table th{padding:0}
-.c14{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}
-.c12{color:#000000;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:11pt;font-family:"Times New Roman";font-style:normal}
-.c10{border-spacing:0;border-collapse:collapse;margin-right:auto}
-.c26{background-color:#ffffff;max-width:468pt;padding:72pt 72pt 72pt 72pt}
-.c25{border:1px solid black;margin:5px}
-.c9{font-weight:400;font-family:"Arial"}
-.c3{height:0pt}
+.c20{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}
+.c23{border-spacing:0;border-collapse:collapse;margin-right:auto}
+.c19{background-color:#ffffff;max-width:468pt;padding:72pt 72pt 72pt 72pt}
+.c14{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}
 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}
 P.text{margin-bottom:0; margin-top:0; margin-left:0; margin-right:0; padding-top:0pt; color:#000000; font-size:11pt; padding-bottom:0pt; font-family:"Arial","Liberation Sans",sans-serif; line-height:1.15; text-align:left; font-weight:400; text-decoration:
none; vertical-align:baseline; font-style:normal}
 P.txts{margin-bottom:0; margin-top:0; margin-left:0; margin-right:0; padding-top:0pt; color:#000000; font-size:11pt; padding-bottom:11pt; font-family:"Arial","Liberation Sans",sans-serif; line-height:1.15; text-align:left; font-weight:400; text-decoration
:none; vertical-align:baseline; font-style:normal}
 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}
-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}
+SPAN.ntrm{font-family:"Arial","Liberation Sans",sans-serif}
+P.a1{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="c26 doc-content"><p class="a2">AI22-0036-1</p>
+</head><body class="c19 doc-content"><p class="a1">AI22-0036-1</p>
 <p class="head">!standard 3.5(56.3/3) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 22-08-19 &nbsp;AI22-0036-1/03</p>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 22-11-03 &nbsp;AI22-0036-1/04</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>
@@ -32,74 +31,106 @@
 <p class="head">!qualifier Omission</p>
 <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>
+
 <p class="text">The &ldquo;current instance&rdquo; rule does not apply when the name of a type is
-used as</p>
-<p class="text">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>
+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="text">If one wants to create a Character type for which the default value is the NUL </p>
-<p class="text">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</p>
-<p class="txts">of the type, so it is not inherited), but all such conversions are illegal.</p>
+<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="c10"></table><p class="text">&nbsp;</p>
-<a id="t.95917217e1d5f0ad5def57a7c4bf5b8bfff0930c"></a><a id="t.1"></a><table class="c10"><tr class="c3"><td class="c14">
+<a id="t.93cdc93f7933f0879b1b6e02881eb544af0506d7"></a><a id="t.0"></a><table class="c23"></table><p class="text">&nbsp;</p>
+<a id="t.95917217e1d5f0ad5def57a7c4bf5b8bfff0930c"></a><a id="t.1"></a><table class="c23"><tr class="c14"><td class="c20">
 <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>
-<p class="text">This is illegal because Char is a constant object (the current instance of</p>
-<p class="txts">type Char), and thus cannot be used as the prefix of a type conversion.</p>
+<p class="txts">This is illegal because Char is a constant object (the current instance of type
+Char), and thus cannot be used as the prefix of a type conversion.</p>
 
 <p class="text">Should some way be available? (Yes.)</p>
 <h2 class="head">!recommendation</h2>
 <p class="text">(See Summary.)</p>
 <h2 class="head">!wording</h2>
 <p class="inst">Replace the final sentence of 8.6(17/3):</p>
-
-<p class="word">These rules do not apply if the usage name appears within the subtype_mark of an
-access_definition for an access-to-object type, or within the subtype of a parameter or result of
-an access-to-subprogram type. </p>
+<p class="word">These rules do not apply if the usage name appears within the
+<span class="ntrm">subtype_mark </span>of an <span class="ntrm">access_definition</span> for an
+access-to-object type, or within the subtype of a parameter or result of an access-to-subprogram
+type. </p>
 <p class="inst">with a bulleted list:</p>
-
 <p class="word">These rules do not apply if the usage name appears:</p>
-<ul class="wbl"><li><span>within the </span><span class="c9">subtype_mark</span><span> of an
-</span><span class="c9">access_definition</span><span class="c12"> for an access-to-object type;
-or</span></li>
-<li><span class="c12">within the subtype of a parameter or result of an access-to-subprogram type;
-or</span></li>
-<li><span>within an </span><span class="c9">aspect_specification</span><span> for the Default_Value
-aspect as the </span><span class="c9">prefix </span><span>of an
-</span><span class="c9">attribute_definition </span><span>for an attribute which is defined for (at
-least some) subtypes and is not defined for (any) objects [redundant: (for example, the Val
-attribute)].</span><sup><a href="#cmnt1">[a]</a></sup></li>
+<ul class="wbl"><li>within the <span class="ntrm">subtype_mark</span> of an
+<span class="ntrm">access_definition</span> for an access-to-object type; or</li>
+<li>within the subtype of a parameter or result of an access-to-subprogram type; or</li>
+<li>within an <span class="ntrm">aspect_specification</span> for the Default_Value aspect as the
+<span class="ntrm">prefix </span>of an <span class="ntrm">attribute_reference </span>for an
+attribute which is defined for (at least some) scalar subtypes and is not defined for (any) scalar
+objects [redundant: (for example, the Val attribute)].</li>
+</ul>
+<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_Pos could not be used as they would freeze the
+type.</p>
+<p class="inst">Replace 13.14(10):</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>
 </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>
 <h2 class="head">!discussion</h2>
-
-<p class="text">It might seem at first that this change would open the door for freezing</p>
-<p class="text">problems that were previously prevented via the current instance rule.</p>
-<p class="text">This is typically not the case because of the possibility of bypassing the</p>
-<p class="text">current instance rule by means of a partial view and a subtype, as in</p>
+<p class="text">It might seem at first that the current instance change would open the door for
+freezing</p>
+<p class="text">problems that were previously prevented via the current instance rule. This is
+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="c10"><tr class="c3"><td class="c14">
+<a id="t.c711c9e162ca63b8a855ee8735fafaf3f57c4794"></a><a id="t.2"></a><table class="c23"><tr class="c14"><td class="c20">
 <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>
  &nbsp; &nbsp; &nbsp;<b>type</b> T <b>is</b> <b>range</b> 1 .. S&#39;Last;<br>
  &nbsp; &nbsp; &nbsp; &nbsp; -- illegal, but not because of the current instance rule</p>
 </td></tr></table><p class="text">&nbsp;</p>
-<p class="text">Most constructs one might attempt which become illegal as a</p>
-<p class="text">result of the current instance rule can be reformulated to use the</p>
-<p class="text">name of a subtype instead of a name that denotes the current instance.</p>
-<p class="text">In such cases, changing the current instance rule to apply in fewer cases</p>
-<p class="text">would not introduce any substantially new freezing scenarios.</p>
+<p class="txts">Most constructs one might attempt which become illegal as a result of the current
+instance rule can be reformulated to use the name of a subtype instead of a name that denotes the
+current instance. In such cases, changing the current instance rule to apply in fewer cases would
+not introduce any substantially new freezing scenarios.</p>
+
+<p class="txts">However, since it is illegal for an aspect specification to contain something that
+would freeze the entity itself (directly or indirectly), we also need to create an additional
+&ldquo;hole&rdquo; in the freezing rules in order to achieve the intended effect. We noted that the
+position numbers of a type are determined solely by the type&rsquo;s definition: the literals and
+their order for an enumeration definition, and static expressions for an integer definition. Thus
+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; is 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>
 <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="c10"><tr class="c3"><td class="c14">
+<a id="t.2ca453b052ff6b219ea9a7573dda84b3aee67fc7"></a><a id="t.3"></a><table class="c23"><tr class="c14"><td class="c20">
 <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>
@@ -111,9 +142,8 @@
 <b>type</b> Char2 <b>is</b> <b>new</b> Character<br>
  &nbsp; &nbsp; &nbsp;<b>with</b> Default_Value =&gt; Char&#39;First;</p>
 </td></tr></table><h2 class="head">!ACATS test</h2>
-
-<p class="text">An ACATS C-Test is needed to check that these attributes are allowed for a</p>
-<p class="text">Default_Value aspect specification.</p>
+<p class="text">An ACATS C-Test is needed to check that these attributes are allowed for a
+Default_Value aspect specification.</p>
 <h2 class="head">!appendix</h2>
 
 <p class="from">From:<span class="name"> Brad Moore [privately]</span></p>
@@ -323,13 +353,4 @@
 
 <p class="txts">****************************************************************</p>
 
-<div class="c25"><p class="txts"><a href="#cmnt_ref1">[a]</a>I formalized this wording, as
-&quot;Default_Value aspect_specification&quot; and &quot;prefix of an attribute&quot; are informal
-ways of referring to these things.</p>
-
-<p class="txts">I&#39;d consider turning this around as well:</p>
-
-<p class="text">as the prefix of an attribute_definition for an attribute which is defined for (at
-least some) subtypes and is not defined for (any) objects [redundant: (for example, the Val
-attribute)], but only within an aspect_specification for the Default_Value aspect</p>
-</div></body></html> 
+</body></html> 

Questions? Ask the ACAA Technical Agent