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-7-bit X-Google-Thread: 103376,43aafc250d42730f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-09 02:41:59 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!195.224.53.60!nntp.news.xara.net!xara.net!gxn.net!server6.netnews.ja.net!server4.netnews.ja.net!server2.netnews.ja.net!newshost.central.susx.ac.uk!news.bton.ac.uk!not-for-mail From: John English Newsgroups: comp.lang.ada Subject: Re: controlled type in generic package? Date: Fri, 09 Feb 2001 10:25:19 +0000 Organization: University of Brighton Message-ID: <3A83C58F.8D891740@bton.ac.uk> References: <3A7FDA9A.C667090F@stn-atlas.de> <95p2ab$463$1@nnrp1.deja.com> <95q1fa$9e$1@usenet.rational.com> <95rpj5$gq7$1@nnrp1.deja.com> <3A82A66D.49DE7EBD@bton.ac.uk> <87r919azac.fsf@deneb.enyo.de> NNTP-Posting-Host: straumli.it.bton.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: saturn.bton.ac.uk 981714297 8720 193.62.183.204 (9 Feb 2001 10:24:57 GMT) X-Complaints-To: news@bton.ac.uk NNTP-Posting-Date: 9 Feb 2001 10:24:57 GMT X-Mailer: Mozilla 4.5 [en] (Win95; I) X-Accept-Language: en Xref: supernews.google.com comp.lang.ada:5051 Date: 2001-02-09T10:24:57+00:00 List-Id: Florian Weimer wrote: > > John English writes: > > > Not only that, but by deriving something from Controlled, you're > > giving up your ability to derive from anything else. If I want to > > derive a new type from an existing (non-Controlled) type and add > > a destructor (Finalize), I have to perform lots of acrobatics and > > commit all sorts of atrocities on my code to do it! > > It's just an ordinary mixin construction. Of course, there some > syntactical overhead involved, but it's straightforward. Not hard to do, but annoying. A type declaration for the controlled type, a separate type declaration for the derived type with a controlled component added in, and if the controlled component's primitives need to look at any components of the original record, some magic spells involving access discriminants and view conversions. This might not bother you, but it feels like acrobatics and atrocities to me. IMHO this is straightforward in the same sense as OOP in C is straightforward: "It's just an ordinary pointer-to-array-of-functions construction. Of course, there's some syntactical overhead involved, but it's straightforward." :-) ----------------------------------------------------------------- John English | mailto:je@brighton.ac.uk Senior Lecturer | http://www.it.bton.ac.uk/staff/je Dept. of Computing | ** NON-PROFIT CD FOR CS STUDENTS ** University of Brighton | -- see http://burks.bton.ac.uk -----------------------------------------------------------------