comp.lang.ada
 help / color / mirror / Atom feed
* generic type identification
@ 2003-01-04  1:50 David Holm
  2003-01-04  2:04 ` chris.danx
  2003-01-04  5:39 ` tmoran
  0 siblings, 2 replies; 11+ messages in thread
From: David Holm @ 2003-01-04  1:50 UTC (permalink / raw)


Hi,
a couple of questions related to generic packages and type specifications.

Lets say I have a package like:
generic
  type New_Type is range <>;
package Example
  procedure Some_Procedure(Item: in New_Type);
end Example;

Is it possible to identify the type of New_Type in the Some_Procedure 
procedure?
I have tried doing stuff like "if New_Type'Range = Integer'Range" etc but 
with little luck.

Another thing that I couldn't find an answer to, is it possible to constrain 
the allowed generic types. Like specifying that New_Type has to be either 
Integer or Float?

The alternative, I guess, would be to not use a generic package and instead 
overload Some_Procedure with those types that I want to be able to use but 
this will clutter the specification file =(.

//David Holm



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

end of thread, other threads:[~2003-01-06 17:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-04  1:50 generic type identification David Holm
2003-01-04  2:04 ` chris.danx
2003-01-04  5:39 ` tmoran
2003-01-04 12:39   ` David Holm
2003-01-04 16:13     ` James S. Rogers
2003-01-05  3:28       ` David Holm
2003-01-05 10:03         ` Gautier
2003-01-04 19:27     ` tmoran
2003-01-05  3:25       ` David Holm
2003-01-05  5:42         ` tmoran
2003-01-06 17:56     ` Stephen Leake

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