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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d2dbb7c2489d3c69 X-Google-Attributes: gid103376,public From: ncohen@watson.ibm.com (Norman H. Cohen) Subject: Re: Q: Dynamically testing type of any variable Date: 1996/06/05 Message-ID: <4p4c3p$tc5@watnews1.watson.ibm.com>#1/1 X-Deja-AN: 158615579 distribution: world references: <4ov0miINN99m@snoopy.cis.ohio-state.edu> organization: IBM T.J. Watson Research Center reply-to: ncohen@watson.ibm.com newsgroups: comp.lang.ada Date: 1996-06-05T00:00:00+00:00 List-Id: In article <4ov0miINN99m@snoopy.cis.ohio-state.edu>, dgibson@snoopy.cis.ohio-state.edu (david scott gibson) writes: |> Hi. Is there any way to determine the type of an arbitrary Ada95 |> variable at runtime? Inside a generic unit, I'd like to test if a |> generic formal has been instantiated with a scalar type, and then if |> so, initialize it to some valid representation. It doesn't appear |> that the 'Class or 'Valid attributes help much since neither is |> defined for all types. Also, I'd prefer not using any exception |> trickery to deal with this. Any ideas? This is a peculiar requirement. Can you give us a better idea of what you are trying to accomplish? If your template is doing things with objects of your generic formal type that are improper for uninitialized scalars, and if a particular invocation of a particular instance actually does these things to uninitialized scalars, why do you want to mask the error behind an arbitrary "valid" value? -- Norman H. Cohen ncohen@watson.ibm.com