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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Controlled types as interfaces Date: Wed, 20 Aug 2014 15:47:56 +0200 Organization: cbb software GmbH Message-ID: References: <17zg1do470nci.15209dgoz3ktk.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: yj8+JIQUMOEawvIM7K49kA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:21854 Date: 2014-08-20T15:47:56+02:00 List-Id: On Wed, 20 Aug 2014 15:49:36 +0300, Victor Porton wrote: > Dmitry A. Kazakov wrote: > >> On Wed, 20 Aug 2014 04:09:15 +0300, Victor Porton wrote: >> >>> Victor Porton wrote: >>>> I think in Ada 202X we can invent Limited_Controlled_Interface and >>>> Controlled_Interface types derived from which could become controlled. >> >> Yes, but that would be very complicated, because you could add an >> interface very late, making a descendant of a non-controlled type >> controlled. >> >> A better solution would be fixing initialization (AKA constructors) and >> leaving controlled kludge as is. > > I don't see any reason not to make descendant of a non-controlled type > controlled. I don't see why any type cannot have initialization hooks either. > Let T is a non-controlled tagged type. > > It descendant Q is like a record > > record > Old: T; > Ext: Q1; > end record; > > (where Q1 is the difference of Q and T). > > Q1 is controlled. > > As there is no problem that this record becomes controlled, there are no > reason not to make Q controlled despite of T was non-controlled. It depends on concrete implementations, e.g. some might require the type tag being at the record's first address. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de