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,be6cbf679aee02c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Why was it done this way ? References: <%DV7f.13378$rE2.2085@fe10.lga> <1130380243.198117.318920@g14g2000cwa.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Thu, 27 Oct 2005 06:09:22 GMT NNTP-Posting-Host: 67.3.219.191 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.pas.earthlink.net 1130393362 67.3.219.191 (Wed, 26 Oct 2005 23:09:22 PDT) NNTP-Posting-Date: Wed, 26 Oct 2005 23:09:22 PDT Xref: g2news1.google.com comp.lang.ada:5980 Date: 2005-10-27T06:09:22+00:00 List-Id: Heimlich Manure wrote: > Well, recursion would explain some but not all of it. Something like > > task type T1; > task body T1 is > MyGhost : T1; > > is illegal. Meanwhile, "T1" is not a subtype within T1. > task type T1; > type T1_Ptr is access T1; > task body T1 is > MyGhostPtr : T1_Ptr; > > is legal. But initializing MyGhostPtr can't be done, obviously, because T1 > is unmentionable within its own scope. It's mentionable, but it is not a subtype name. > Or even worse : > > task type T1; > type T1_Ghost is new T1; > task body T1 is > MyGhostPtr : T1_Ghost; > > Even this is legal ! T1_Ghost is a subtype name within T1. Within T1, "T1" refers to the current instance of the type. ARM 9.1: "Within the declaration or body of a task unit, the name of the task unit denotes the current instance of the unit (see 8.6), rather than the first subtype of the corresponding task type (and thus the name cannot be used as a subtype_mark)." It turns out to be useful for an instance of a task type to be able to refer to itself. This is why these things don't behave the way you seem to expect. The basic answer to your original question is that the language does not require compilers to be smart enough to detect infinite mutual recursion like this, any more than it requires that they detect infinite mutual recursion between subprograms. -- Jeff Carter "From this day on, the official language of San Marcos will be Swedish." Bananas 28