comp.lang.ada
 help / color / mirror / Atom feed
From: Serge Robyns <serge.robyns@gmail.com>
Subject: Re: I'm facing an issue with: call to abstract procedure must be dispatching
Date: Tue, 8 Dec 2015 09:48:32 -0800 (PST)
Date: 2015-12-08T09:48:32-08:00	[thread overview]
Message-ID: <b15caf13-8e37-47ac-8947-4a1ff599b8f8@googlegroups.com> (raw)
In-Reply-To: <n473vt$jdu$1@dont-email.me>

On Tuesday, 8 December 2015 18:30:59 UTC+1, Jeffrey R. Carter  wrote:
> with T1_Ops;
> with T2_Ops;
> ...
> package Storage is
>    procedure Put (Item : in T1_Ops.T1);
> 
>    procedure Put (Item : in T2_Ops.T2);
> 
>    ...
> end Storage;
> 
> The bodies of the Put procedures correspond to your Insert procedures. (You can
> call them Insert, too, if you like, but I once heard it asserted that a
> correctly designed Ada program has 90% of its operations named Put or Get.)
> 
> This is then used as
> 
> with Storage;
> 
> ...
> 
> Storage.Put (Item => Current_Item);
> 
> which is the same regardless of the type of the item being stored. To change the
> storage method, you change the body of Storage.

This seems indeed a workable solution.  Actually, in my initial version I had one big package for the implementation.  I found this "ugly" and wanted to decimate them as per package under the form of child packages.  This also allows me to use private types, as children can access private elements.

My question is then, how can I easily manage this from a source management perspective.  As I said in a prior post, changing the "with/use" everywhere or use some file system "tricks" to fool the compiler to pick the "right" version.
Maybe there is some Ada "feature" to do this nicely.  As I said in a prior post, in C and C++ I would use the pre-processor to pick the "right" one.

> Note that programming by extension is neither necessary nor desirable for this.

I've noticed from your papers you generally disapproves "programming by extension".

Serge


  reply	other threads:[~2015-12-08 17:48 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
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 [this message]
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