comp.lang.ada
 help / color / mirror / Atom feed
From: benari@zeus.datasrv.co.il (Moti Ben-Ari)
Subject: Deriving from non-null abstract type
Date: 1995/03/29
Date: 1995-03-29T00:00:00+00:00	[thread overview]
Message-ID: <3lbh2q$8ov@israel-info.datasrv.co.il> (raw)

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:

  D: Derived_Type := (Abstract_Type with S);

which means that the component General_Info has to
be initialized in a separate statement.
This seems to be against the philosophy of Ada which
provides aggregates so that you won't forget to initialize
a component.

Is there some way of creating a value that I don't see?
If not, why aren't abstract types restricted to null records?

Moti

Moti Ben-Ari
benari@datasrv.co.il






             reply	other threads:[~1995-03-29  0:00 UTC|newest]

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

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