comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Private extension of a synchronized interface
Date: Sun, 17 Feb 2019 22:36:38 +0000
Date: 2019-02-17T22:36:38+00:00	[thread overview]
Message-ID: <lypnrqnitl.fsf@pushface.org> (raw)
In-Reply-To: fd975d66-8e70-4e86-8a75-efc6061ef25c@googlegroups.com

Jere <jhb.chat@gmail.com> 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

  parent reply	other threads:[~2019-02-17 22:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-16  0:52 Private extension of a synchronized interface Jere
2019-02-17  9:50 ` Dmitry A. Kazakov
2019-02-17 13:46   ` Jere
2019-02-17 14:52     ` Dmitry A. Kazakov
2019-02-17 15:36       ` Jere
2019-02-17 16:28         ` Dmitry A. Kazakov
2019-02-17 20:56           ` Jere
2019-02-17 22:36 ` Simon Wright [this message]
2019-02-18  0:36   ` Jere
2019-02-18  8:11     ` Dmitry A. Kazakov
2019-02-18  8:29       ` Simon Wright
2019-02-18  8:42         ` Dmitry A. Kazakov
2019-02-18  8:26     ` Simon Wright
2019-02-18  8:33     ` Simon Wright
2019-02-18 15:40       ` Jere
2019-02-18 17:24         ` Simon Wright
2019-02-19 11:04           ` Simon Wright
2019-02-20  2:36             ` Jere
2019-02-20 10:46               ` Simon Wright
2019-02-20 15:04                 ` Jere
2019-02-18 15:49       ` Jere
2019-02-18 22:06 ` Randy Brukardt
2019-02-18 22:35 ` Randy Brukardt
2019-02-19 10:01   ` Egil H H
2019-02-19 11:29     ` Simon Wright
2019-02-19 11:53       ` Egil H H
2019-02-20  2:32   ` Jere
2019-02-20 13:46   ` Simon Wright
2019-02-20 23:43     ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox