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,1ce805592e46d231 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-04 04:41:01 PST Path: archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!212.74.64.35!colt.net!dispose.news.demon.net!news.demon.co.uk!demon!pipehawk.demon.co.uk!not-for-mail From: john.mccabe@emrad.com.nospam (John McCabe) Newsgroups: comp.lang.ada Subject: Re: (elementary question) Test on type ? Date: Tue, 04 Sep 2001 11:39:22 GMT Organization: Emrad Ltd Message-ID: <3b94bb3e.13397965@news.demon.co.uk> References: <9n24g4$17q$1@snipp.uninett.no> <9n279a$1ua$1@snipp.uninett.no> <3B94B4B4.CE1955D6@nbi.dk> <9n2ctk$36v$1@snipp.uninett.no> NNTP-Posting-Host: pipehawk.demon.co.uk X-NNTP-Posting-Host: pipehawk.demon.co.uk:158.152.226.81 X-Trace: news.demon.co.uk 999603607 nnrp-14:8595 NO-IDENT pipehawk.demon.co.uk:158.152.226.81 X-Complaints-To: abuse@demon.net X-Newsreader: Forte Free Agent 1.21/32.243 Xref: archiver1.google.com comp.lang.ada:12683 Date: 2001-09-04T11:39:22+00:00 List-Id: On Tue, 4 Sep 2001 13:05:21 +0200, Reinert Korsnes wrote: >> Seriously, what are you trying to do? > >Just do a bit different things in the function depending on the type >of X. Say, X is Float of Interger.... Generics are the place to do identical stuff independent of the types. If you want to do different stuff depending on the type, then you should use overloaded function. I'm not sure whether this is possible (and I can't check at the moment as I don't use Ada any more), but you may be able to pass overloaded functions as generic actual parameters and then just make a call where the compiler will handle the types. e.g. generic type MyType is (<>); with procedure Test (InParm : in Integer); with procedure Test (InParm : in SomeOtherDiscreteType); package X : Then call Test when you want. I guess what you could do was define a type somewhere e.g: type PossibleTypes is (Int, Flt, Enum); then use declare the Test operations as functions that returned that type. Hope this helps. Best Regards John McCabe