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!news.glorb.com!hwmnpeer01.lga!hwmedia!hw-filter.lga!fe10.lga.POSTED!53ab2750!not-for-mail From: "Heimlich Manure" Newsgroups: comp.lang.ada References: <%DV7f.13378$rE2.2085@fe10.lga> <1130380243.198117.318920@g14g2000cwa.googlegroups.com> Subject: Re: Why was it done this way ? X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Message-ID: Date: Wed, 26 Oct 2005 22:39:29 -0400 NNTP-Posting-Host: 68.192.120.72 X-Complaints-To: abuse@cv.net X-Trace: fe10.lga 1130380722 68.192.120.72 (Wed, 26 Oct 2005 19:38:42 MST) NNTP-Posting-Date: Wed, 26 Oct 2005 19:38:42 MST Organization: Optimum Online Xref: g2news1.google.com comp.lang.ada:5976 Date: 2005-10-26T22:39:29-04:00 List-Id: Well, recursion would explain some but not all of it. Something like task type T1; task body T1 is MyGhost : T1; is illegal. Meanwhile, 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. Or even worse : task type T1; type T1_Ghost is new T1; task body T1 is MyGhostPtr : T1_Ghost; Even this is legal ! So I humbly sense an inconsistency in "dynamicness" of tasks - it should either allow full throttle recursion, or detect such loops at compile-time and barf. But I beg to be forgiven, I just started looking at Ada a week ago. wrote in message news:1130380243.198117.318920@g14g2000cwa.googlegroups.com... > > Heimlich Manure wrote: > > Hello respectable group, > > > > This may be a silly question but I'm sure there was reasoning behind > > allowing such : > > > > with Ada.Text_IO; > > use Ada.Text_IO; > > > > procedure My_Example is > > task type T1; > > task type T2; > > > > task body T1 is > > begin > > Put_Line("Instantiating T2 from T1"); > > declare > > T_2_2 : T2; > > begin > > null; > > end; > > end T1; > > > > task body T2 is > > begin > > Put_Line("Instantiating T1 from T2"); > > declare > > T_1_1 : T1; > > begin > > null; > > end; > > end T2; > > > > T_1 : T2; > > begin > > null; > > end My_Example; > > > > Question is, why is this legit ? > > What do you think should be wrong with this? > > Think of instances of tasks as active objects. > Each task creates an instance of the other task. > > Granted, this program will run forever until the > stack exhausted. In that manner, this program is > a little like a recursive algorithm with no > terminating condition. > > Jim Rogers >