CVS difference for ai12s/ai12-0138-1.txt
--- ai12s/ai12-0138-1.txt 2014/10/14 03:53:10 1.2
+++ ai12s/ai12-0138-1.txt 2014/11/19 00:10:11 1.3
@@ -1,4 +1,9 @@
-!standard 13.1.1(34/3) 14-10-13 AI05-0138-1/01
+!standard 13.1.1(34/3) 14-10-19 AI05-0138-1/02
+!standard 4.1.5(5/3)
+!standard 4.1.6(6/3)
+!standard 4.1.6(7/3)
+!standard 4.1.6(8/3)
+!standard 5.5.1(21/3)
!class binding interpretation 14-10-13
!status work item 14-10-13
!status received 14-06-26
@@ -30,31 +35,59 @@
!wording
-Replace 13.1.1(34/3)
+Insert after 13.1.1(34/3).
- If an aspect of a derived type is inherited from an ancestor type and has the
- boolean value True, the inherited value shall not be overridden to have the
- value False for the derived type, unless otherwise specified in this
- International Standard.
+ Certain type-related aspects are defined to be *immutable*.
+ If an immutable aspect is directly specified for a type T, then that
+ aspect shall not be directly specified for any other descendant of T.
+
+[Alternatively:
+ If an immutable aspect is directly specified for a type T, then any
+ explicit specification of that aspect for any other descendant of T
+ shall be confirming.
+]
+
+ In addition to the places where Legality Rules normally apply (see
+ 12.3), this rule applies also in the private part of an instance of a
+ generic unit.
+
+ The Default_Iterator. Implicit_Dereference, Constant_Indexing,
+ and Variable_Indexing aspects are defined to be immutable.
+
+----
+
+Replace 4.1.6(6-8/3)
+
+ The Constant_Indexing or Variable_Indexing aspect shall not be
+ specified:
+ - on a derived type if the parent type has the corresponding
+ aspect specified or inherited; or
+ - on a full_type_declaration if the type has a tagged partial
+ view.
+
with
- In some cases (see below), an aspect of a type is defined to be
- *immutably inherited*. If an aspect of the parent type in a
- ``derived_type_definition`` is immutably inherited, then
- - that aspect of the the derived type is immutably inherited; and
- - any specification of that aspect for the derived type shall be
- confirming.
-
- In addition to the places where Legality Rules normally apply (see 12.3),
- this rule applies also in the private part of an instance of a generic unit.
-
- Unless otherwise specified in this International Standard, any Boolean
- aspect of a type whose value is True is immutably inherited.
- The Default_Iterator aspect of any type for which the aspect is specified
- is immutably inherited. Similarly for the aspects Implicit_Dereference,
- Constant_Indexing, and Variable_Indexing.
+ The Constant_Indexing or Variable_Indexing aspect shall not be
+ specified on a full_type_declaration if the type has a tagged
+ partial view.
+----
+
+Add at the end of the Legality Rules section of 5.5.1 (after 5.5.1(21/3):
+
+ The Default_Iterator or Iterator_Element aspect shall not be
+ specified on a full_type_declaration if the type has a tagged
+ partial view.
+
+----
+
+Add to the (currently nonexistent) Legality Rules section of 4.1.5 (after 4.1.5(5/3)):
+
+ The Implicit dereference aspect shall not be
+ specified on a full_type_declaration if the type has a discriminated
+ partial view.
+
!discussion
In 4.1.5, no need to eliminate "if not overridden" wording. It is fine
@@ -67,9 +100,8 @@
is fine as it stands. [Editor's note: AI12-0104-1 removed the above wording
and replaced it by a User Note, which is OK.]
-Does the "can't override" rule look through privacy?
-Is T2 in the following example legal? If so, then
-what is the status of the instantiation?
+The new Legality rules in 4.1.5 and 5.5.1 are needed so that privacy is
+not compromised by these rules.
package Pkg1 is
type Rec is record Int : Integer; end record;
@@ -84,8 +116,8 @@
function F return Integer;
end;
private
- Type T1 (D1, D2 : access Rec) is null record with
- Implicit_Dereference => D1;
+ type T1 (D1, D2 : access Rec) is null record with
+ Implicit_Dereference => D1; -- Illegal by new rule.
end;
package body Pkg1 is
@@ -96,13 +128,9 @@
package Pkg2 is
use Pkg1;
- type T2 is new T1 with Implicit_Dereference => D2; -- legal?
- package I is new G (T2); -- legal?
+ type T2 is new T1 with Implicit_Dereference => D2; -- No check here.
+ package I is new G (T2); -- Trouble here if T1 was legal.
end;
-
-[Editor: Of course it doesn't look through privacy. We fixed that problem
-for Variable_Indexing and Constant_Indexing by not allowing them to be
-hidden. Some fix is needed for the two new cases.]
!ASIS
Questions? Ask the ACAA Technical Agent