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!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Private extension of a synchronized interface Date: Sun, 17 Feb 2019 22:36:38 +0000 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="16e1b671cf89750f0b7ac1400c8561b1"; logging-data="29170"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18uBtx7mHmof3OkSbqEM164xXRCHxJzTg4=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (darwin) Cancel-Lock: sha1:eapzR+TC7kTAEyj+YIT2zlolYR8= sha1:uAhA1Lq+EnUAb7CofA9EBsnr+W8= Xref: reader01.eternal-september.org comp.lang.ada:55553 Date: 2019-02-17T22:36:38+00:00 List-Id: Jere writes: > -- The following line gives the error: > -- call to abstract procedure must be dispatching > > --v.p1; If you replace this with the dispatching call Example.An_Interface'Class (v).p1; it compiles & works just fine. I'm far from being an expert on this, because I've never found the need to use 'interface' at all, but when you say type An_Interface is synchronized interface; procedure p1(Self : in out An_Interface) is abstract; type Instance is synchronized new An_Interface with private; you know that Instance provides a procedure p1, but you don't know whether it's a task or protected entry or a protected procedure (or even, to my surprise, a plain procedure with that profile, see Ada 2005 Rationale). Of course the compiler knows, so you'd have thought that your v.p1 call would be OK (and it _is_ OK if the full declaration of Example.Instance is public). But the actual problem comes from ARM 3.9.3(7)[1], A call on an abstract subprogram shall be a dispatching call; nondispatching calls to an abstract subprogram are not allowed. ... which has been the case since Ada 95! [1] http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-3-9-3.html#p7