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=0.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_FROM_MSSP autolearn=no 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 07:07:21 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!feed.textport.net!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: <9n24g4$17q$1@snipp.uninett.no> <9n279a$1ua$1@snipp.uninett.no> <3B94B4B4.CE1955D6@nbi.dk> <9n2ctk$36v$1@snipp.uninett.no> <9n2l16$bqv$1@nh.pace.co.uk> Subject: Re: (elementary question) Test on type ? Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Tue, 04 Sep 2001 10:07:13 EDT Organization: http://www.newsranger.com Date: Tue, 04 Sep 2001 14:07:13 GMT Xref: archiver1.google.com comp.lang.ada:12696 Date: 2001-09-04T14:07:13+00:00 List-Id: In article <9n2l16$bqv$1@nh.pace.co.uk>, Marin David Condic says... > >What you are trying to do is basically impossible in Ada. You can't have a >generic parameter that is, say, "private" and then try to test to see if the >actual is of type Integer or Float. There are a couple of reasons for this: Actually it is doable, if the type in question is a tagged type. In that case you can easily do something like: if Object_A in Parent_Type_X'class then .... The reason this won't work for Integer is that Integer isn't tagged. Thus: 1) You can't use 'Class on it (or a subtype of it). 2) You can't pass it into a routine that can also take other types for the same parameter. I suppose you would be able to do that with Integer if Ada had a type system where every type was derived from some common root type. I think there are some languages out there that work that way. Ada just isn't one of them. --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html home email - mailto:dennison@telepath.com