From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6eac62e4f2badf3a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-11 09:39:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!82-43-33-254.cable.ubr01.croy.blueyonder.co.UK!not-for-mail From: Nick Roberts Newsgroups: comp.lang.ada Subject: Re: Persistence of limited tagged types Date: Fri, 11 Apr 2003 17:39:16 +0100 Organization: ThoughtWing Computer Software Message-ID: References: <1ec946d1.0304091509.150cc6d7@posting.google.com> NNTP-Posting-Host: 82-43-33-254.cable.ubr01.croy.blueyonder.co.uk (82.43.33.254) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15; format=flowed X-Trace: fu-berlin.de 1050079156 12325628 82.43.33.254 (16 [25716]) In-Reply-To: User-Agent: Opera7.03/Win32 M2 build 2670 Xref: archiver1.google.com comp.lang.ada:36093 Date: 2003-04-11T17:39:16+01:00 List-Id: On 10 Apr 2003 19:37:38 -0400, Robert A Duff wrote: > Nick Roberts writes: > >> According to the RM95 (13.13 (36)) (which I'm certain you must have >> already consulted, Matt) the stream-oriented attributes (Read, Write, >> Input, Output) are defined for all types, but defaults are not provided >> for limited types. > > Be careful in "consulting the RM". The Ada 95 RM is somewhat buggy in > this area, and there are some AI's published by the ARG on the subject. > If your compiler does not obey the AI's, you might want to complain to > your compiler vendor. Well warned, Bob. I've had a peruse, and the relevant AIs seem to be as follows. AI95-00108/08 says :- For a type extension, the predefined Read attribute is defined to call the Read of the parent type, followed by the Read of the non-inherited components, if any, in canonical order. The analogous rule applies to the Write attribute. The Input and Output attributes are not inherited by a type extension. Default stream attributes are never inherited; rather, the default implementation for the derived type is used. The stream attributes must work properly for every language-defined nonlimited type. For language-defined private types, the output generated by the Write attribute is not specified, but it must be readable by the Read attribute. AI95-00137/08 says :- 13.1(10) says: For an untagged derived type, no type-related representation items are allowed if the parent type is a by-reference type, or has any user- defined primitive subprograms. This rule does not apply to an attribute_definition_clause for one of the stream-oriented attributes Read, Write, Input, and Output. AI95-00195/14 says :- 1 - When the predefined Input attribute creates an object, this object undergoes default initialization and finalization. 2 - For the purposes of checking legality rules, it is necessary to determine whether a stream-oriented attribute has been specified for a limited type (13.13.2(9/1) and 13.13.2(36/1)). This is done by applying the normal visibility rules to the attribute_definition_clause. 3 - For a limited tagged type T, if Read is available then T'Input is available, even if it is not specified. Similarly, if Write is available then T'Output is available. T'Class'Read, T'Class'Write, T'Class'Input and T'Class'Output are available only if they are specified or the corresponding specific attribute is available somewhere within the same list of declarations as T. 4 - In the profiles of the stream-oriented attributes, the notation "italicized T" refers to the base subtype for a scalar type, and to the first subtype otherwise. 5 - In an attribute_definition_clause for a stream-oriented attribute, the name shall not denote an abstract subprogram. 6 - The predefined Read attribute for composite types with defaulted discriminants must ensure that, if exceptions are raised by the Read attribute for some discriminant, the discriminants of the actual object passed to Read are not modified. This may require the creation of an anonymous object, which undergoes initialization and finalization. 7 - The predefined Read attribute for composite types with defaulted discriminants must raise Constraint_Error if the discriminants found in the stream differ from those of the actual parameter to Read, and this parameter is constrained. 8 - If S is a subtype of an abstract type, an attribute_reference for S'Input is illegal unless this attribute has been specified by an attribute_definition_clause. 9 - The number of calls performed by the predefined implementation of the stream-oriented attributes on the Read and Write operations of the stream type is unspecified. An implementation may take advantage of this permission to perform internal buffering. However, all the calls on the Read and Write operations of the stream type needed to implement an explicit invocation of a stream-oriented attribute must take place before this invocation returns. AI95-00240/04 says :- E.2.2(14) and E.2.3(14) should allow any type with available Read and Write stream attributes. None of these strike me as permitting GNAT's behaviour. -- Nick Roberts Jabber: debater@charente.de [ICQ: 159718630]