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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,309015504ed37ff0 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-30 06:39:15 PST Path: archiver1.google.com!news2.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!feed2.news.rcn.net!rcn!nntp.abs.net!ash.uu.net!spool.news.uu.net!not-for-mail Date: Tue, 30 Sep 2003 09:38:31 -0400 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030901 Thunderbird/0.2 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Usage of Interfaces with Ada 95 References: <1064595326.831730@master.nyc.kbcfp.com> <4nii41-067.ln1@boavista.snafu.de> <3F7726E4.6040402@comcast.net> <3F78F430.1070909@comcast.net> In-Reply-To: <3F78F430.1070909@comcast.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1064929111.851223@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@nightcrawler.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1064929112 29032 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:15 Date: 2003-09-30T09:38:31-04:00 List-Id: Robert I. Eachus wrote: > Nope! Mix-ins to the rescue. You can mix a component of a type derived > from Controlled (or Limited Controlled) into an uncontrolled type. In > fact, the base type doesn't even need to be tagged. Access > discriminants can be used to allow the operations of the controlled > component to access the entire record. (But if you use this style you > will find that the access discriminants are not often needed.) Let me see if I have this right. I believe that in Ada, controlled types can be declared only at library level, correct? So if the mix-in is going to do something with its containing object, then doesn't the type of the containing object have to be declared at library level as well? This means that the awkward inheritance-based model of controlled drives the package structure, which seems like a bad idea to me. I don't see that mix-ins gain you very much in this case anyway. If you're going to have a mix-in with an access discriminant, why not just make the containing type controlled? I suppose it's because you may already need to be part of another inheritance hierarchy, which just brings back the MI question.