From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d4b510aac9184a29 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-18 11:12:17 PST Path: nntp.gmd.de!Germany.EU.net!EU.net!howland.reston.ans.net!news1.digex.net!ois.com!ois.com!not-for-mail From: beckwb@ois.com (R. William Beckwith) Newsgroups: comp.lang.ada Subject: Re: Ada95 and Dynamic Type Identification Date: 18 Jan 1995 14:12:17 -0500 Organization: Objective Interface Systems, Inc. Message-ID: <3fjp6h$9ad@gamma.ois.com> References: NNTP-Posting-Host: gamma.ois.com X-Newsreader: TIN [version 1.2 PL2] Date: 1995-01-18T14:12:17-05:00 List-Id: 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