comp.lang.ada
 help / color / mirror / Atom feed
From: Samuel Tardieu <sam@ada.eu.org>
To: "Bob Fletcher" <bob@radge.globalnet.co.uk>
Subject: Re: run-time type identification
Date: 1998/09/03
Date: 1998-09-03T00:00:00+00:00	[thread overview]
Message-ID: <m367f58j5g.fsf@zaphod.enst.fr> (raw)
In-Reply-To: 01bdd72e$49ee66b0$f330ea9e@ukp03332

>>>>> "Bob" == Bob Fletcher <bob@radge.globalnet.co.uk> writes:

Bob> It seems to me that this is something that would make a lot of
Bob> sense when dealing with class-wide access types, which can easily
Bob> be used to go up the object heirarchy, but not, as far as I know,
Bob> to go back down, (without messing about with
Bob> unchecked_conversion).

You can do it in Ada: (pseudo-code that compiles but is obviously incorrect)

package T is
   type A is tagged null record;
   type A2 is new A with null record;
   type A_Ptr is access all A'Class;
   Z : A_Ptr;
   Y : constant A2 := A2 (Z.all);
end T;

Of course, Constraint_Error will be raised if Z.all does not belong to 
A2'Class.

  Sam
-- 
Samuel Tardieu -- sam@ada.eu.org




  parent reply	other threads:[~1998-09-03  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-03  0:00 run-time type identification Bob Fletcher
1998-09-03  0:00 ` Matthew Heaney
1998-09-03  0:00   ` Bob Fletcher
1998-09-03  0:00     ` Matthew Heaney
1998-09-03  0:00 ` Steve Sabljak
1998-09-03  0:00   ` Steve Sabljak
1998-09-03  0:00   ` Matthew Heaney
1998-09-03  0:00 ` Tucker Taft
1998-09-03  0:00 ` Samuel Tardieu [this message]
1998-09-03  0:00   ` Bob Fletcher
1998-09-03  0:00     ` Matthew Heaney
1998-09-06  0:00       ` Samuel Tardieu
1998-09-03  0:00     ` Fergus Henderson
replies disabled

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