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-Thread: 103376,73057f1a3ca11607 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news2.google.com!proxad.net!newsfeed.stueberl.de!news-mue1.dfn.de!news-ham1.dfn.de!news.uni-hamburg.de!cs.tu-berlin.de!uni-duisburg.de!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: Is T an ancestor of T? Date: Fri, 15 Oct 2004 17:19:22 +0000 (UTC) Organization: GMUGHDU Message-ID: References: <1738418.atIT6LYH9Z@linux1.krischik.com> <1940150.rU8f1KaX3L@linux1.krischik.com> <6577257.BAFHMKqgPc@linux1.krischik.com> <1406724.hY6njLzCIG@linux1.krischik.com> <2668948.gJfALsUrHD@linux1.krischik.com> NNTP-Posting-Host: l1-hrz.uni-duisburg.de X-Trace: a1-hrz.uni-duisburg.de 1097860762 10325 134.91.1.34 (15 Oct 2004 17:19:22 GMT) X-Complaints-To: usenet@news.uni-duisburg.de NNTP-Posting-Date: Fri, 15 Oct 2004 17:19:22 +0000 (UTC) User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (HP-UX/B.11.00 (9000/800)) Xref: g2news1.google.com comp.lang.ada:5285 Date: 2004-10-15T17:19:22+00:00 List-Id: Martin Krischik wrote: : Georg Bauhaus wrote: : :> Martin Krischik wrote: :> :> :> 'class as return type of constructor functions creates a number of :> :> not-so-nice conversion necessities that I'd like to avoid. :> : :> : I thought as an example. Not to actually use this constructor pattern. :> :> Interestingly, GNAT complains if T is derived from some other :> type Base. For example, :> :> function Make return T'Class is :> begin :> return T'(T with N => 42); :> end Make; :> :> :> 7. return T'(T with N => 42); :> | :> >>> expect ancestor type of "T" :> :> (Same for specific T.) : : Well T is not an ancestor of T. Not in this example where it is derived from another type, named Base. : T is T itself. You might want try the : example with a tagged type which actually has a parent to see the : difference. This is exactly what I have been doing, the results above are for a T that is derived from another type, named Base. In this GNAT spits out this error message. Otherwise it doesn't. I still don't know whether or not a type is an ancestor of itself, given that it is a descendant of itself. -- Georg