comp.lang.ada
 help / color / mirror / Atom feed
From: Nick Roberts <nickroberts@blueyonder.co.uk>
Subject: Re: Persistence of limited tagged types
Date: Fri, 11 Apr 2003 17:39:16 +0100
Date: 2003-04-11T17:39:16+01:00	[thread overview]
Message-ID: <oprng4jqncbqmqul@news.cis.dfn.de> (raw)
In-Reply-To: <wccof3d9b5p.fsf@shell01.TheWorld.com>

On 10 Apr 2003 19:37:38 -0400, Robert A Duff <bobduff@shell01.TheWorld.com> 
wrote:

> Nick Roberts <nickroberts@blueyonder.co.uk> 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]



  reply	other threads:[~2003-04-11 16:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-07 12:47 Persistence of limited tagged types Jano
2003-04-07 14:47 ` Nick Roberts
2003-04-09 10:05   ` Nick Roberts
2003-04-10  3:32     ` tmoran
2003-04-09 23:09   ` Matthew Heaney
2003-04-10 14:40     ` Nick Roberts
2003-04-10 23:37       ` Robert A Duff
2003-04-11 16:39         ` Nick Roberts [this message]
2003-04-10 18:49     ` Randy Brukardt
2003-04-10  1:12   ` Matthew Heaney
2003-04-07 18:11 ` Stephen Leake
2003-04-07 19:07   ` Hyman Rosen
2003-04-07 22:09     ` Jano
2003-04-08 13:58       ` Matthew Heaney
2003-04-10 11:41         ` Julio Cano
2003-04-10 19:14           ` Jano
2003-04-11 12:54             ` Julio Cano
2003-04-07 20:17   ` Robert Spooner
2003-04-07 21:14     ` Stephen Leake
2003-04-08 12:56       ` Robert Spooner
2003-04-08 13:41         ` Jano
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox