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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,43b6c5f649185450,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-03 17:50:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uio.no!newsfeed.song.fi!newsfeed5.telia.com!194.22.194.4.MISMATCH!masternews.telia.net.!newsb.telia.net.POSTED!not-for-mail From: David Holm Subject: generic type identification Newsgroups: comp.lang.ada User-Agent: KNode/0.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit Message-ID: Date: Sat, 04 Jan 2003 01:50:31 GMT NNTP-Posting-Host: 217.208.105.23 X-Complaints-To: abuse@telia.com X-Trace: newsb.telia.net 1041645031 217.208.105.23 (Sat, 04 Jan 2003 02:50:31 CET) NNTP-Posting-Date: Sat, 04 Jan 2003 02:50:31 CET Organization: Telia Internet Xref: archiver1.google.com comp.lang.ada:32511 Date: 2003-01-04T01:50:31+00:00 List-Id: 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