From: stt@dsd.camb.inmet.com (Tucker Taft)
Subject: Re: Mut. Recurs. in Ada9X w/o Breaking Encaps.? (LONG)
Date: Thu, 29 Sep 1994 14:01:45 GMT
Date: 1994-09-29T14:01:45+00:00 [thread overview]
Message-ID: <Cww9My.JH@inmet.camb.inmet.com> (raw)
In-Reply-To: 1994Sep29.021209.20769@swlvx2.msd.ray.com
In article <1994Sep29.021209.20769@swlvx2.msd.ray.com>,
John Volan <jgv@swl.msd.ray.com> wrote:
>NHC = ncohen@watson.ibm.com (Norman H. Cohen) writes:
>
>NHC>One variation on this is to declare recursive types meant to serve as the
>NHC>parents of types Employee and Office, but to provide no operations for
>NHC>these recursive types. Then, in child packages, declare Employee and
>NHC>Office themselves as derived types and declare primitive operations in
>NHC>those child packages:
>NHC>
>NHC> with ... ; -- other stuff needed by Employee
>NHC> with ... ; -- other stuff needed by Office
>NHC>
>NHC> package Employees_And_Offices is
>NHC>
>NHC> type Employee_Parent is tagged limited private;
>NHC> type Employee_Pointer is access all Employee'Class;
>NHC>
>NHC> type Office_Parent is tagged limited private;
>NHC> type Office_Pointer is access all Office'Class;
>
>This solution suffers from the same problem as Mark Biggar's suggestion:
>These access types only give clients an "opaque" view of the designated objects.
>The useful primitive operations for these objects won't be declared until we
>get to the concrete *subclasses* declared later. So a client would have to
>resort to using a non-typesafe Unchecked_Conversion to "downcast" one of these
>pointers into designating the corresponding concrete subclass.
As mentioned in a previous post, there is no need to use
non-typesafe Unchecked_Conversion. A safe, checked, explicit "downcast"
(or "narrowing") conversion is permitted in Ada 9X when the operand is
of a class-wide type, or of an access-to-class-wide type.
See RM9X-4.6(15, 23, 42, 50);5.0.
>-- John Volan
>-- Company => "Raytheon Missile Systems Division",
>-- E_Mail_Address => "jgv@swl.msd.ray.com",
S. Tucker Taft stt@inmet.com
Intermetrics, Inc.
Cambridge, MA 02138
next prev parent reply other threads:[~1994-09-29 14:01 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-09-27 16:52 Mut. Recurs. in Ada9X w/o Breaking Encaps.? (LONG) John Volan
1994-09-27 18:48 ` Mark A Biggar
1994-09-29 1:46 ` John Volan
1994-09-29 13:57 ` Tucker Taft
1994-09-29 17:20 ` Bjarne Stroustrup <9758-26353> 0112760
1994-09-30 1:38 ` Tucker Taft
1994-09-30 12:33 ` Bjarne Stroustrup <9758-26353> 0112760
1994-09-29 18:37 ` John Volan
1994-09-29 19:34 ` David Weller
1994-09-30 22:13 ` John Volan
1994-10-02 3:31 ` Andrew Lees
1994-09-30 1:47 ` Tucker Taft
1994-09-30 13:30 ` John Volan
1994-09-29 18:10 ` R. William Beckwith
1994-10-03 0:33 ` Cyrille Comar
1994-09-28 14:01 ` Norman H. Cohen
1994-09-29 2:12 ` John Volan
1994-09-29 14:01 ` Tucker Taft [this message]
1994-09-29 18:37 ` Norman H. Cohen
1994-09-29 9:48 ` Magnus Kempe
1994-09-29 13:10 ` Magnus Kempe
1994-09-29 18:05 ` Tucker Taft
1994-09-30 10:20 ` Mut. Recurs. in Ada9X w/o Breaking Encaps.? Magnus Kempe
1994-09-30 13:22 ` Tucker Taft
1994-10-01 1:24 ` Mut. Recurs. in Ada9X w/o Breaking Encaps.? (LONG) Adam Beneschan
1994-10-01 12:01 ` Magnus Kempe
1994-10-01 18:43 ` Mark A Biggar
1994-10-02 16:41 ` John Volan
1994-10-02 23:33 ` Matt Kennel
1994-10-03 8:07 ` Mut. Recurs. in Ada9X w/o Breaking Encaps.? Magnus Kempe
1994-10-03 12:14 ` Mut. Recurs. in Ada9X w/o Breaking Encaps.? (LONG) Robert I. Eachus
1994-10-04 2:12 ` R. William Beckwith
1994-10-04 16:00 ` John Volan
1994-10-05 11:42 ` Robert I. Eachus
1994-10-05 21:09 ` Matt Kennel
1994-10-03 20:29 ` Harry Koehnemann
1994-09-29 13:35 ` John Volan
1994-09-30 20:27 ` Norman H. Cohen
1994-10-01 1:47 ` John Volan
1994-10-01 20:44 ` Tucker Taft
1994-10-03 11:29 ` Robert I. Eachus
1994-09-30 22:46 ` Matt Kennel
1994-10-01 2:11 ` John Volan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox