comp.lang.ada
 help / color / mirror / Atom feed
From: "Richard Charts" <richard.charts@gmail.com>
Subject: Re: Extend Record in Spec and Body
Date: 16 Oct 2006 10:20:11 -0700
Date: 2006-10-16T10:20:11-07:00	[thread overview]
Message-ID: <1161019211.319933.248220@i42g2000cwa.googlegroups.com> (raw)
In-Reply-To: <0ed0he.ife.ln@hunter.axlog.fr>


Jean-Pierre Rosen wrote:
> richard.charts@gmail.com a écrit :
> > Is it possible to extend a record twice in a package?
> > I'm building a component now that will be mostly reusable.  There are a
> > couple packages that are the same, but for one piece the differences
> > require different code.  However, with the way it is designed, it seems
> > I could make the package specs the same and only alter the bodies.
> > I would like to try to hide part of the extended record from the
> > specification without having to change  the operation declarations.
> >
> > I included a small slice of what I'm trying to do.  Is this even
> > possible?
> > Thanks.
> >
> > SPEC:
> >
> > private
> >     type Object is new HigherPackage.object
> >     with record
> >         Repo_View   : Repo_View_Array;
> >     end record;
> >
> > end spec;
> >
> > body
> >     type Object is new HigherPackage.object  -- This is where I'm not
> > sure how to proceed
> >     with record
> >         Data: Data_Array;
> >         Ack: boolean;
> >     end record;
> >
> This is not allowed as stated, but you could derive an Internal_Object
> from Object in the body, and add conversions where needed.
>
> --
> ---------------------------------------------------------
>             J-P. Rosen (rosen@adalog.fr)
> Visit Adalog's web site at http://www.adalog.fr


As a kind of similar question, is it legal to extend an object and have
the new object be variant?

type Object (Type: New_Type is new HigherPackage.object
    with record
        Repo_View   : Repo_View_Array;
        case Type is
            Something =>
                 Test : Natural;
end record;




  reply	other threads:[~2006-10-16 17:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-16 15:30 Extend Record in Spec and Body richard.charts
2006-10-16 16:53 ` Jean-Pierre Rosen
2006-10-16 17:20   ` Richard Charts [this message]
2006-10-17  0:33     ` Georg Bauhaus
2006-10-17  1:11     ` Randy Brukardt
2006-10-17  7:30 ` Dmitry A. Kazakov
2006-10-17 18:49   ` Simon Wright
2006-10-17 20:19     ` Dmitry A. Kazakov
replies disabled

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