comp.lang.ada
 help / color / mirror / Atom feed
From: beckwb@ois.com (R. William Beckwith)
Subject: Re: Ada95 and Dynamic Type Identification
Date: 18 Jan 1995 14:12:17 -0500
Date: 1995-01-18T14:12:17-05:00	[thread overview]
Message-ID: <3fjp6h$9ad@gamma.ois.com> (raw)
In-Reply-To: milodD2Ko8z.98w@netcom.com

John DiCamillo (milod@netcom.com) wrote:

: Does Ada95 have some sort of dynamic type identification
: equivalent to C++ RTTI or Eiffel's assignment-attempt?
: That is, given a procedure

:    procedure Process_Alerts(A: Alert'Class) ...

: Is there any way to find out precisely what type of
: object A is?  Or are we limited to dynamic dispatch?

: e.g.:

:       foo: FooAlert;         -- special alert
:    begin
:       foo ?= A;              -- is A a FooAlert?
:       if (foo'Valid) then    -- A IS a FooAlert!
:          FooHandler( foo );  -- do something that only
:                              -- applies to FooAlerts

4.5.2 Relational Operators and Membership Tests

    if A in FooAlert'CLASS then       -- is A a FooAlert?
       FooHandler(FooAlert'CLASS(A)); -- do something that only
    end if;                           -- applies to FooAlerts

The FooAlert'CLASS(A) type conversion is thus guaranteed
to work.

: Anyway, if dynamic typing was left out of Ada95, would 
: that be considered a mistake. Every other statically
: typed OOPL I know of has eventually provided some form
: of dynamic typing.  Why not Ada?  Is there some subtlety
: about Ada's type system that makes dynamic typing un-
: necessary or irrelevant?

Yes, leaving dynamic typing would have been a mistake.
I'm sure glad Ada95 has such a nice dynamic typing system.

... Bill



      parent reply	other threads:[~1995-01-18 19:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <milodD2Ko8z.98w@netcom.com>
1995-01-18  8:48 ` Ada95 and Dynamic Type Identification Stephane Barbey
1995-01-18 12:39 ` Robert A Duff
1995-01-18 17:33 ` David Moore
1995-01-18 19:12 ` R. William Beckwith [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