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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: interfaces and limited/controlled/limited-controlled types Date: Fri, 26 Jan 2018 09:28:10 +0100 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: MyFhHs417jM9AgzRpXn7yg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.2 Xref: reader02.eternal-september.org comp.lang.ada:50160 Date: 2018-01-26T09:28:10+01:00 List-Id: On 26/01/2018 05:58, Randy Brukardt wrote: > "Mehdi Saada" <00120260a@gmail.com> wrote in message > news:ea190839-2f83-4dbb-9064-8d6f535cc1d0@googlegroups.com... >> Is it only because of history and compatibility issues, that >> Limited_Controlled and Controlled aren't rewrote as interfaces ? >> Like: T_type is limited new Ancestor_type with Controlled >> or T_type is new Ancestor_type with Limited_Controlled >> >> Or is there a semantic issue too ? > > A compatibility issue IS a semantic issue! Yes, the main reason is > compatibilty. We've looked at ways to allow Root_Streams_Type to be an > interface (same problem), and the levels of semantic trouble that occurs > makes it a dubious proposition (at least so far). Stream and pool interfaces are simpler I suppose than having a controlled interface. However having an ability to add finalization later would be an indispensable feature. Existing workarounds are not good at all. BTW, was it considered to add new interfaces without making existing base types members of? It would not look clean but it would be 100% compatible: type is interface; procedure Initialize (Object : in out ) is abstract; procedure Adjust (Object : in out ) is abstract; procedure Finalize (Object : in out ) is abstract; type Controlled is abstract new with private; overriding procedure Initialize (Object : in out Controlled) is null; overriding procedure Adjust (Object : in out Controlled) is null; overriding procedure Finalize (Object : in out Controlled) is null; type Controlled_Interface is new ; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de