comp.lang.ada
 help / color / mirror / Atom feed
From: dan@cs.uq.oz.au (Dan Johnston D.B.)
Subject: Re: Deriving from non-null abstract type
Date: 30 Mar 1995 01:53:48 GMT
Date: 1995-03-30T01:53:48+00:00	[thread overview]
Message-ID: <3ld2vc$1cu@uqcspe.cs.uq.oz.au> (raw)
In-Reply-To: 3lbh2q$8ov@israel-info.datasrv.co.il

In <3lbh2q$8ov@israel-info.datasrv.co.il> benari@zeus.datasrv.co.il (Moti Ben-Ari) writes:

>I would like to derive from a _non-null_ abstract tagged type:

>  type Abstract_Type is abstract tagged
>    record
>      General_Info: Some_Type;
>    end record;

>  type Derived_Type is new Abstract_Type with
>    record
>      Special_Info: Some_Other_Type;
>    end record;

>Of course, you can't create a value of the abstract type,
>but it turns out that it is impossible to create a value
>of the derived type:

>    D: Derived_Type := (G with S);

>because G would have to be an aggregate of an abstract type 
>which is illegal. The only thing you can do is:

You can use an ordinary aggregate
     ( General_Info => Some_Type, Special_Info => Some_Other_Type )

I sympathise because this problem had me hung up for a considerable time too.
You (and I also) obviously expected that an aggregate of an extension type
must be an extension-aggregate, but this is not the case.
The only real confirmation of this that I can find in the manual is the last
example in section 3.9.1 where the Painted_Point aggregate is an example
of an extended type represented as an ordinary aggregate.

Perhaps there should be a note in section 3.9.2 of the manual saying that
aggregates of extended types don't have to be extension-aggregates.
    dan.          dan@cs.uq.oz.au



      parent reply	other threads:[~1995-03-30  1:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-29  0:00 Deriving from non-null abstract type Moti Ben-Ari
1995-03-29  0:00 ` Tucker Taft
1995-03-29  0:00 ` Robert I. Eachus
1995-03-30  0:00   ` Tucker Taft
1995-03-30  1:53 ` Dan Johnston D.B. [this message]
replies disabled

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