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,34cc14b2a30b4c03 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!k39g2000yqb.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Wikibook on Ada Programming - Object Orientation Date: Thu, 8 Jul 2010 09:07:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: <2dcc40df-72f1-443c-9afd-4415af4e63b9@k39g2000yqb.googlegroups.com> References: <4758a0b7-21f7-4a8e-97ec-d9468d5d598f@j4g2000yqh.googlegroups.com> NNTP-Posting-Host: 153.98.68.197 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1278605233 9635 127.0.0.1 (8 Jul 2010 16:07:13 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 8 Jul 2010 16:07:13 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k39g2000yqb.googlegroups.com; posting-host=153.98.68.197; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:12268 Date: 2010-07-08T09:07:10-07:00 List-Id: On Jul 8, 11:34=A0am, AdaMagica wrote: > I have a problem with an example inhttp://en.wikibooks.org/wiki/Ada_Progr= amming/Object_Orientation#Multi... > > It proposes to use a mixin together with the Rosen trick, however for > unlimited types. This cannot work! > > When such an object is assigned, the disciminant will inevitably point > to the wrong object. I wrote a test case and confirm this; there is indeed a problem. > For a detailed discussion of the problems involved, see my paper in > Ada Letters, Volume XIX, Number 4, December 1999, which you can also > find here: > > http://www.christ-usch-grein.homepage.t-online.de/Ada/Finalization.html I'm not sure your solution works in all cases because it uses only one "slot" per task, per tagged type, to store the access value to the enclosing object. My gut feeling is that this makes assumptions as to the ordering of calls to Adjust and Finalize that may not be always correct in the presence of multiple objects of the same type. > Ada 2005 changed some of the rules; now mix-ins can have access > discriminants to nonlimited types, but the problem persists. > > So how should the wikibook be corrected? Are there safe solutions to > the problem of mixins? Right, I'm curious. I re-read sections on controlled types and mixin inheritance in John Barnes' book but he leaves this entire problem as an exercise to the reader (specifically, exercise 19.3). This seems too complicated for a beginner. -- Ludovic Brenta.