comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: I'm facing an issue with: call to abstract procedure must be dispatching
Date: Tue, 8 Dec 2015 22:08:47 +0100
Date: 2015-12-08T22:08:47+01:00	[thread overview]
Message-ID: <vjaapo5l3d0f.19ppdnxybx3i4.dlg@40tude.net> (raw)
In-Reply-To: 14acd8b0-a5e9-40fd-b7cc-d319f914d507@googlegroups.com

On Tue, 8 Dec 2015 12:21:31 -0800 (PST), Serge Robyns wrote:

> At times it proves to be helpful to write a sample test to clear away the
> clutter.  Actually the whole issue appeared because I've been introducing
> the members to the T_Abstract_Data_Store as following:
> 
>    type T_Abstract_Data_Store is abstract tagged limited record
>       Clients: access T_Abstract_Client;  -- was missing 'Class
>       Store2 : access T_Abstract_Store2;  -- was missing 'Class
>    ...

If you really need mix-in then better do it like this:

   type T_Abstract_Data_Store
      (  Clients : not null access T_Abstract_Client'Class;
         Store2 : not null access T_Abstract_Store2'Class
      )  is abstract tagged limited record

This would add a bit more safety, much needed when using access types.

> Now to go back to the overall solution.  This is one of the rare cases
> where multiple inheritance would have made things easier, as then the non
> abstract class would "inherit" from the parents the respective
> implementations like in C++ class T_Store : public T_Store1, public
> T_Store2, ....  Then I could just write "A_Store.Insert (Client);" as this
> was my original code as I had "glue" code in the body of T_Store package,
> overriding all the interfaces.

Why MI is needed here? Of which of two stores is Insert?

There is an ugly method of achieving poor-man's full MI. Full means that
you inherit multiple implementations rather than only interfaces. The
latter is allowed in Ada. The method is that you inherit one implementation
normally and add others through a generic. I don't want to describe it,
because it is really ugly as anything that involves generics. I am not sure
you need full MI in first place.

> I know that this statement will spark some discussions between the two
> "camps" as per Jeffrey's comment.

There are people in c.l.a who believe in procedural decomposition and
inference from the type structure. It is incompatible with fundamental
Ada's principles of strong typing and separation of interface and
implementation. But that is my opinion.

> My only long term concern is how many people can program in Ada?

If you do, that is one man more... Any language lives by people who want to
use it.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2015-12-08 21:08 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 16:45 I'm facing an issue with: call to abstract procedure must be dispatching Serge Robyns
2015-12-08 16:59 ` G.B.
2015-12-08 17:04 ` Dmitry A. Kazakov
2015-12-08 17:24   ` Serge Robyns
2015-12-08 17:42     ` Dmitry A. Kazakov
2015-12-08 18:00       ` Serge Robyns
2015-12-08 18:22         ` Dmitry A. Kazakov
2015-12-08 20:21           ` Serge Robyns
2015-12-08 21:08             ` Dmitry A. Kazakov [this message]
2015-12-08 21:55               ` Serge Robyns
2015-12-08 22:43                 ` Serge Robyns
2015-12-08 22:55                   ` Jeffrey R. Carter
2015-12-09 23:03                     ` Randy Brukardt
2015-12-10  8:38                       ` Serge Robyns
2015-12-10 23:43                         ` Randy Brukardt
2015-12-09  8:48                 ` Dmitry A. Kazakov
2015-12-09 10:53               ` G.B.
2015-12-09 12:03                 ` Dmitry A. Kazakov
2015-12-09 13:42                   ` G.B.
2015-12-09 14:23                     ` Dmitry A. Kazakov
2015-12-08 22:55             ` Jeffrey R. Carter
2015-12-08 23:04               ` Serge Robyns
2015-12-08 23:42                 ` Jeffrey R. Carter
2015-12-09 13:40                 ` Jere
2015-12-09 13:48                   ` G.B.
2015-12-09 15:33                     ` Jere
2015-12-13 21:37                 ` Shark8
2015-12-14  2:20                   ` Jeffrey R. Carter
2015-12-15  7:26                     ` Shark8
2015-12-08 17:30 ` Jeffrey R. Carter
2015-12-08 17:48   ` Serge Robyns
2015-12-08 18:46     ` Jeffrey R. Carter
2015-12-08 20:28       ` Serge Robyns
2015-12-08 22:20     ` Simon Wright
replies disabled

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