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 X-Google-Thread: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-23 01:36:15 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn11feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!sccrnsc01.POSTED!not-for-mail Message-ID: <3F700591.2020703@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? References: <3F5F7FDC.30500@attbi.com> <3F6079A9.6080108@attbi.com> <3F60E380.4020307@attbi.com> <3F694186.5060709@crs4.it> <3F6F1688.9030903@attbi.com> <1064247974.78844@master.nyc.kbcfp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 24.34.139.183 X-Complaints-To: abuse@comcast.net X-Trace: sccrnsc01 1064306066 24.34.139.183 (Tue, 23 Sep 2003 08:34:26 GMT) NNTP-Posting-Date: Tue, 23 Sep 2003 08:34:26 GMT Organization: Comcast Online Date: Tue, 23 Sep 2003 08:34:26 GMT Xref: archiver1.google.com comp.lang.ada:42783 Date: 2003-09-23T08:34:26+00:00 List-Id: I said: > But if you want to inherit from two classes with state, and adjust > the state of each based on changes to the other, the na�ve implementation > isn't possible in Ada, and causes indefinite recursion in C++. > > What indefinite recursion? This na�ve implementation: struct A { int a; virtual void set_a(int aa) { a = aa; } }; struct B { int b; virtual void set_b(int bb) { b = bb; } }; struct AB : A, B { void set_a(int aa) { set_a(aa); set_b(aa + 1); } void set_b(int bb) { set_a(bb - 1); set_b(bb); } }; In Ada, as in C++ you can break the recursion by specificly calling the operations for the parent classes. Actually you only need to call the super operation for one to break the recursion, but you know what I mean. The point about Ada was that if you write equivalent code, you will get wacked at compile time for the set_b call. (If you "fix" it by declaring the subroutine and then providing a separate body, you will get it to compile, but you won't get the results you want.) -- Robert I. Eachus Ryan gunned down the last of his third white wine and told himself it would all be over in a few minutes. One thing he'd learned from Operation Beatrix: This field work wasn't for him. --from Red Rabbit by Tom Clancy.