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!feeder.eternal-september.org!aioe.org!.POSTED.yTvCNOh9TRCAIcX40YItlQ.user.gioia.aioe.org!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Private extension of a synchronized interface Date: Sun, 17 Feb 2019 10:50:21 +0100 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: yTvCNOh9TRCAIcX40YItlQ.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 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:55536 Date: 2019-02-17T10:50:21+01:00 List-Id: On 2019-02-16 01:52, Jere wrote: > I'll get to my ultimate goal later, but while following various > rabbit trails, I came across a situation I couldn't solve. GNAT > allows you to make private extensions to synchronized interfaces > and it allows you to complete those private extensions with > protected types. I can't, however, figure out how it overrides > the abstract procedures and functions of the synchronized interface. > > If I don't specify an override and try to call the procedure, it complains > that the procedure is abstract. If I try to override the abstract > function, it complains that the signature doesn't match the one in > the protected body. I don't know if this is a GNAT issue or > something that Ada doesn't allow. Here is some test code. It > compiles as is, but there are two parts that if you uncomment > either one of those it fails to compile. Reading RM 9.5.2 (13.2/2) does not really help: "if the overriding_indicator is overriding, then the entry shall implement an inherited subprogram;" An inherited subprogram is already implemented per, well, inheritance. May be it means: 1. shall implement a primitive operation (it overrides here); 2. shall implement an overridden primitive operation (it implements overriding declared earlier). Neither #1 nor #2 work. But synchronized interfaces are totally bogus from the software design POV. It is a pure implementation aspect exposed. Why do you care? Aggregate a protected object and delegate primitive operations to it. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de