comp.lang.ada
 help / color / mirror / Atom feed
* Q: Dynamically testing type of any variable
@ 1996-06-03  0:00 david scott gibson
  1996-06-05  0:00 ` Norman H. Cohen
  0 siblings, 1 reply; 2+ messages in thread
From: david scott gibson @ 1996-06-03  0:00 UTC (permalink / raw)



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?

Dave
--
dgibson@cis.ohio-state.edu





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Q: Dynamically testing type of any variable
  1996-06-03  0:00 Q: Dynamically testing type of any variable david scott gibson
@ 1996-06-05  0:00 ` Norman H. Cohen
  0 siblings, 0 replies; 2+ messages in thread
From: Norman H. Cohen @ 1996-06-05  0:00 UTC (permalink / raw)



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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-06-05  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-03  0:00 Q: Dynamically testing type of any variable david scott gibson
1996-06-05  0:00 ` Norman H. Cohen

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