CVS difference for ai22s/ai22-0036-1.html
--- ai22s/ai22-0036-1.html 2022/06/17 06:13:50 1.1
+++ ai22s/ai22-0036-1.html 2022/09/03 05:35:45 1.2
@@ -1,29 +1,29 @@
-<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><title>AI22-0036-1/02</title>
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><title>AI22-0036-1/03</title>
<style type="text/css">
table td,table th{padding:0}
-.c16{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}
-.c6{border-spacing:0;border-collapse:collapse;margin-right:auto}
-.c8{background-color:#ffffff;max-width:468pt;padding:72pt 72pt 72pt 72pt}
-.c19{text-decoration-skip-ink:none;-webkit-text-decoration-skip:none;text-decoration:underline}
-.c9{color:inherit;text-decoration:inherit}
-.c22{height:0pt}
+.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}
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.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}
-SPAN.ins{color:#005500}
-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}
+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}
</style>
-</head><body class="c8"><p class="a1">AI22-0036-1</p>
+</head><body class="c26 doc-content"><p class="a2">AI22-0036-1</p>
<p class="head">!standard 3.5(56.3/3)
- 22-04-26 AI22-0036-1/02</p>
+ 22-08-19 AI22-0036-1/03</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,9 +32,11 @@
<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="text">Attributes 'First, 'Last, and 'Val are specially recognized in
-the expression </p>
-<p class="text">of a Default_Value aspect.</p>
+<p class="text">The “current instance” 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>
<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>
@@ -44,11 +46,11 @@
<p class="txts">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="c6"><tbody></tbody></table><p class="text"> </p>
-<a id="t.95917217e1d5f0ad5def57a7c4bf5b8bfff0930c"></a><a id="t.1"></a><table class="c6"><tbody><tr class="c22"><td class="c16">
+<a id="t.93cdc93f7933f0879b1b6e02881eb544af0506d7"></a><a id="t.0"></a><table class="c10"></table><p class="text"> </p>
+<a id="t.95917217e1d5f0ad5def57a7c4bf5b8bfff0930c"></a><a id="t.1"></a><table class="c10"><tr class="c3"><td class="c14">
<p class="codt"> <b>type</b> Char <b>is</b> <b>new</b> Character <br>
<b>with</b> Default_Value => Char (Ada.Characters.Latin_1.Nul);</p>
-</td></tr></tbody></table><p class="text"> </p>
+</td></tr></table><p class="text"> </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>
@@ -56,90 +58,48 @@
<h2 class="head">!recommendation</h2>
<p class="text">(See Summary.)</p>
<h2 class="head">!wording</h2>
-<p class="inst">Add after 3.5 (56.g/5)</p>
+<p class="inst">Replace the final sentence of 8.6(17/3):</p>
-<p class="word">For the current instance of a type T used as the aspect_definition of a
-specification for aspect Default_Value, the following attributes are defined:</p>
-<p class="word">T'First T'First denotes the lower bound of the range of T. The value
-of this attribute is of the type of T. </p>
-<p class="word"> </p>
-<p class="word">T'Last T'Last denotes the upper bound of the range of T. The value of this
-attribute is of the type of T.</p>
-<p class="inst">Modify 13.14(10/5)</p>
-
-<p class="word">At the place where an expression causes freezing, the type of the expression is
-frozen, unless the expression is <span class="ins">{either}</span> an enumeration literal used as
-a<span class="c19"><a class="c9" href="http://www.ada-auth.org/standards/2xaarm/html/AA-3-8-1.html#S0074">
-</a></span><span class="ntrm"><a class="c9" href="http://www.ada-auth.org/standards/2xaarm/html/AA-3-8-1.html#S0074">discrete_choice</a></span>
-of
-the<span class="c19"><a class="c9" href="http://www.ada-auth.org/standards/2xaarm/html/AA-4-3-3.html#S0113">
-</a></span><span class="ntrm"><a class="c9" href="http://www.ada-auth.org/standards/2xaarm/html/AA-4-3-3.html#S0113">array_aggregate</a></span>
-of
-an<span class="c19"><a class="c9" href="http://www.ada-auth.org/standards/2xaarm/html/AA-13-4.html#S0350">
-</a></span><span class="ntrm"><a class="c9" href="http://www.ada-auth.org/standards/2xaarm/html/AA-13-4.html#S0350">enumeration_representation_clause</a></span>
-or as
-the<span class="c19"><a class="c9" href="http://www.ada-auth.org/standards/2xaarm/html/AA-13-1-1.html#S0348">
-</a></span><span class="ntrm"><a class="c9" href="http://www.ada-auth.org/standards/2xaarm/html/AA-13-1-1.html#S0348">aspect_definition</a></span>
-of a specification for aspect Default_Value<span class="ins">{, or an attribute reference with
-attribute designator First, Last, or Val used as the <span class="ntrm">aspect_definition</span> of
-a specification for aspect Default_Value}</span>. </p>
-<p class="inst">Modify 13.14(10.a.1/5)</p>
-
-<p class="word">We exclude uses of enumeration literals <span class="ins">{and specific attribute
-references with static values}</span> that are used in part for setting the representation of the
-type (aspect Default_Value is defined to be a representation aspect) so we don't freeze the
-type while determining its representation. </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="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>
<h2 class="head">!discussion</h2>
-<p class="text">We previously decided in AI12-0367-1 to only add a narrow rule allowing </p>
-<p class="text">enumeration literals. We considered other cases at that time, and did not</p>
-<p class="text">think they were important enough. We did not consider this example at that</p>
-<p class="text">time, and we probably would have had a different opinion if we had done so.</p>
-<p class="text">The best solution to this problem is to allow at least T'Val, as it allows</p>
-<p class="text">arbitrary position numbers of the type. The use of T'First and T'Last
-also</p>
-<p class="text">seem natural (we know the values without freezing, as the bounds of any</p>
-<p class="txts">scalar *type* are required to be static).</p>
-
-<p class="text">However, inside of an aspect specification, the name of the type refers to</p>
-<p class="text">the current instance of the type. The usual scalar attributes are not</p>
-<p class="text">defined on an object, and even if they were, referencing the current </p>
-<p class="txts">instance would cause circular freezing.</p>
-
-<p class="text">In order to avoid both of these problems, we need to specially define the</p>
-<p class="text">use of these attributes in the expression of a Default_Value aspect</p>
-<p class="txts">specification.</p>
-
-<p class="text">Note that we don't want to allow any scalar attribute. Many attributes
-would</p>
-<p class="text">necessarily require the type to be frozen first (think 'Size or
-'Enum_Rep),</p>
-<p class="text">which would cause circularities. Similarly, We only define these for the </p>
-<p class="text">associated type; allowing them on a subtype of the type could cause circular</p>
-<p class="text">freezing issues for the same reason (the bounds of the subtype could involve</p>
-<p class="text">an attribute that itself would require freezing of the base type, which is</p>
-<p class="txts">circular).</p>
-
-<p class="text">[Editor's opinion: This seems to me to be quite a bit of mechanism for a</p>
-<p class="text">problem that only occurs for the type Character, Wide_Character, and</p>
-<p class="text">Wide_Wide_Character (as these are the only enumeration types that do not have</p>
-<p class="text">a nameable enumeration literals for every position). As such, it seems to</p>
-<p class="text">make more sense as an Amendment; it can then be implemented if there is</p>
-<p class="text">sufficient demand for it (it will be interesting to see if others run into</p>
-<p class="txts">this problem).]</p>
-
-<p class="text">We considered whether ‘Enum_Val should also be allowed. While that is a</p>
-<p class="text">possibility, it was felt that the attributes ‘First, ‘Last, and
-‘Val provide enough</p>
-<p class="text">capability to deal with a need that should be quite rare in practice, and
-furthermore,</p>
-<p class="text">‘Val is more broadly useful than ‘Enum_Val, since it can be applied to
-other scalar</p>
-<p class="text">types than enumeration types.</p>
+<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"> </p>
+<a id="t.c711c9e162ca63b8a855ee8735fafaf3f57c4794"></a><a id="t.2"></a><table class="c10"><tr class="c3"><td class="c14">
+<p class="codt"> <b>type</b> T <b>is</b> <b>private</b>;<br>
+ <b>private</b><br>
+ <b>subtype</b> S <b>is</b> T;<br>
+ <b>type</b> T <b>is</b> <b>range</b> 1 .. S'Last;<br>
+ -- illegal, but not because of the current instance rule</p>
+</td></tr></table><p class="text"> </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>
<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.2"></a><table class="c6"><tbody><tr class="c22"><td class="c16">
+<a id="t.2ca453b052ff6b219ea9a7573dda84b3aee67fc7"></a><a id="t.3"></a><table class="c10"><tr class="c3"><td class="c14">
<p class="codt">Nul_Pos : <b>constant</b> Integer := <br>
Character'Pos (Ada.Characters.Latin_1.NUL); -- equals 0<br>
<br>
@@ -150,7 +110,7 @@
<br>
<b>type</b> Char2 <b>is</b> <b>new</b> Character<br>
<b>with</b> Default_Value => Char'First;</p>
-</td></tr></tbody></table><h2 class="head">!ACATS test</h2>
+</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>
@@ -363,4 +323,13 @@
<p class="txts">****************************************************************</p>
-</body></html>
+<div class="c25"><p class="txts"><a href="#cmnt_ref1">[a]</a>I formalized this wording, as
+"Default_Value aspect_specification" and "prefix of an attribute" are informal
+ways of referring to these things.</p>
+
+<p class="txts">I'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>
Questions? Ask the ACAA Technical Agent