CVS difference for ais/ai-00260.txt

Differences between 1.7 and version 1.8
Log of other versions for file ais/ai-00260.txt

--- ais/ai-00260.txt	2001/10/19 01:36:44	1.7
+++ ais/ai-00260.txt	2002/01/04 22:50:22	1.8
@@ -1,4 +1,4 @@
-!standard 13.13.2  (31)                               01-06-02  AI95-00260/01
+!standard 13.13.2  (31)                               02-01-04  AI95-00260/02
 !standard 13.13.2  (34)
 !class amendment 01-02-13
 !status work item 01-06-02
@@ -18,7 +18,7 @@
 cannot be replaced, so it is not possible to write the tag in an arbitrary
 user-defined format (to match an external standard, for example).
 
-Consider, for example, XML objects, which are a text formal. With the current
+Consider, for example, XML objects, which are a text format. With the current
 language definition, it is not possible to redefine the 'Read and 'Write
 attribute to have the object streamed as an XML object. This is surprising,
 as external tags are defined as strings. It is possible to change the external
@@ -33,24 +33,27 @@
 Two new operational attributes are defined for reading and writing tags.
 These attributes are used in S'Class'Input and S'Class'Output.
 
-For every specific tagged subtype S, the following attributes are defined.
+For every tagged subtype S'Class of a class-wide type T'Class, the following
+attributes are defined:
 
-   S'Tag_Write
+   S'Class'Tag_Write
 
-        procedure S'Tag_Write (Stream : access Streams.Root_Stream_Type'Class;
-                               Tag : Ada.Tags.Tag);
+        procedure S'Class'Tag_Write (
+                Stream : access Streams.Root_Stream_Type'Class;
+                Tag : Ada.Tags.Tag);
 
-	S'Tag_Write writes the value of Tag to Stream.
+	S'Class'Tag_Write writes the value of Tag to Stream.
 
-   S'Tag_Read
+   S'Class'Tag_Read
 
-        function S'Tag_Read (Stream : access Streams.Root_Stream_Type'Class)
-            return Ada.Tags.Tag;
+        function S'Class'Tag_Read (
+                Stream : access Streams.Root_Stream_Type'Class)
+                return Ada.Tags.Tag;
 
 	S'Tag_Read reads a tag from Stream, and returns its value.
 
-The Tag_Write and Tag_Read attributes of the parent type are inherited when
-a type is derived. The default implementation of Tag_Write is to call
+If T is a derived type, then the parent class-wide type's attributes are
+called. Otherwise, the default implementation of Tag_Write is to call
 String'Output(Stream, Tags.External_Tag(Item'Tag)), which is what Ada 95
 defines as the way of writing tags to a stream. Similarly, the default
 implementation of Tag_Read is to return the value of
@@ -66,9 +69,10 @@
 
 !discussion
 
-These attributes can be set on any tagged type, not just the root of a class.
-This is important so that stream representation can be controlled for types
-whose root is not in the user's control: controlled types, for example.
+These attributes can be set on any class-wide tagged type, not just the root
+of a class. This is important so that stream representation can be controlled
+for types whose root is not in the user's control: controlled types, for
+example.
 
 We have to limit the tag values that can be presented to user-specified
 Tag_Read and Tag_Write routines, as otherwise they would have to be able to
@@ -77,7 +81,8 @@
 handle the case where some tag not in S'Class is presented to S'Class'Input.
 The wording "returns that result" does not have this effect, as conversions
 are defined as part of the execution of a return_statement. (This is a minor
-hole in Ada 95, which gets more serious with user-defined tag reading).
+hole in Ada 95, discussed in AI-279, which gets more serious with
+user-defined tag reading).
 
 Note that RM 13.13.1(31) is missing a right parenthesis in the call to
 String'Output, and it is missing the Stream parameter. But this paragraph will
@@ -85,32 +90,34 @@
 
 !wording:
 
-Add after 13.13.1(27):
+Add after 13.13.1(28):
 
-For every subtype S of a specific tagged type T, the following operational
-attributes are defined.
+   S'Class'Tag_Write
 
-   S'Tag_Write
+        procedure S'Class'Tag_Write (
+                Stream : access Streams.Root_Stream_Type'Class;
+                Tag : Ada.Tags.Tag);
 
-        procedure S'Tag_Write (Stream : access Streams.Root_Stream_Type'Class;
-                               Tag : Ada.Tags.Tag);
+	S'Class'Tag_Write writes the value of Tag to Stream.
 
-	S'Tag_Write writes the value of Tag to Stream.
+   S'Class'Tag_Read
 
-   S'Tag_Read
+        function S'Class'Tag_Read (
+                Stream : access Streams.Root_Stream_Type'Class)
+                return Ada.Tags.Tag;
 
-        function S'Tag_Read (Stream : access Streams.Root_Stream_Type'Class)
-            return Ada.Tags.Tag;
-
 	S'Tag_Read reads a tag from Stream, and returns its value.
 
-The Tag_Write and Tag_Read attributes of the parent type are inherited as
-specified in 13.1. The default implementation of Tag_Write is to call
-String'Output(Stream, Tags.External_Tag(Tag)) -- see 3.9. The default
-implementation of Tag_Read is to return the value of
-Tags.Internal_Tag(String'Input(Stream)).
+The default implementations of the Tag_Write and Tag_Read operate as follows:
+  * If T is type derived from type P, the default implementation of Tag_Write
+    calls P'Class'Tag_Write, and the default implementation of Tag_Read
+    calls P'Class'Tag_Read;
+  * Otherwise,  the default implementation of Tag_Write calls
+    String'Output(Stream, Tags.External_Tag(Tag)) -- see 3.9. The default
+    implementation of Tag_Read returns the value of
+    Tags.Internal_Tag(String'Input(Stream)).
 
-User-specifed Tag_Read and Tag_Write attributes may raise an exception if
+User-specified Tag_Read and Tag_Write attributes may raise an exception if
 presented with a tag value not in S'Class.
 
 Replace 13.13.1(31) by:
@@ -197,12 +204,12 @@
    procedure Write (S : access Ada.Streams.Root_Stream_Type'Class;
                     Tag : Ada.Tags.Tag);
      -- Write a tag of the form "<External_Tag>".
-   for Object'Tag_Write use Write;
+   for Object'Class'Tag_Write use Write;
 
    function Read (S : access Ada.Streams.Root_Stream_Type'Class)
      return Ada.Tags.Tag;
      -- Read a tag of the form "<External_Tag>".
-   for Object'Tag_Read use Read;
+   for Object'Class'Tag_Read use Read;
 
 end Class;
 

Questions? Ask the ACAA Technical Agent