From: David Holm <david@realityrift.com>
Subject: generic type identification
Date: Sat, 04 Jan 2003 01:50:31 GMT
Date: 2003-01-04T01:50:31+00:00 [thread overview]
Message-ID: <H5rR9.3971$FF4.246557@newsb.telia.net> (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
next reply other threads:[~2003-01-04 1:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-04 1:50 David Holm [this message]
2003-01-04 2:04 ` generic type identification 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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox