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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.135.150 with SMTP id r22mr775137ioi.24.1449593152504; Tue, 08 Dec 2015 08:45:52 -0800 (PST) X-Received: by 10.182.112.135 with SMTP id iq7mr11244obb.10.1449593152485; Tue, 08 Dec 2015 08:45:52 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!mv3no10564865igc.0!news-out.google.com!f6ni17080igq.0!nntp.google.com!mv3no10564856igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 8 Dec 2015 08:45:52 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=94.107.233.114; posting-account=6m7axgkAAADBKh082FfZLdYsJ24CXYi5 NNTP-Posting-Host: 94.107.233.114 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8bc7fd76-f00a-4eea-9715-470af028fc84@googlegroups.com> Subject: I'm facing an issue with: call to abstract procedure must be dispatching From: Serge Robyns Injection-Date: Tue, 08 Dec 2015 16:45:52 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:28707 Date: 2015-12-08T08:45:52-08:00 List-Id: Gents, I've been trying to get my head around a way to create a solution where the= storage method can be changed. For this I'm using Ada's interface languag= e construct. So far I've only be successful with the following construct, = whereas store1, store2, etc are implementations to store object1, object2, = etc. These are created as child packages of their respective objects so th= ey can access the private parts. type T_Abstract_Data_Store is limited interface and Store1_Interface and Store2_Interface ... In the implementation "class" type T_Data_Store is limited new T_Abstract_Data_Store with record Store1 : T_Store1; Store2 : T_Store2; ... This then requires to write glue code to implement a link to the different = implementations of the stores.=20 procedure Insert (Store : in out T_Data_Store; Obj : in T_XYZ'Class) is begin Store.Store1.Insert (Obj); end Insert; This could have been avoided if Ada would have allowed some form of multi-i= nheritance of in the instance of a multi-interface "class". Now I've been trying to resolve this through another mean but I'm now facin= g the "call to abstract procedure must be dispatching" error message which = I cannot explain nor resolve. Below an a sample compile-able piece of code. package Clients is -- could also be in private part .... type T_Client is tagged record ID : Natural; end record; end Clients; with Clients; use Clients; package Abstract_Store is type T_Asbtract_Store is limited interface; procedure Insert (Store : in out T_Asbtract_Store; Client : in T_Client'Class) is abstract; -- actually in my code Client will be a subclass of T_Client, for exampl= e -- T_Client_DAO'Class end Abstract_Store; with Clients; use Clients; with Abstract_Store; use Abstract_Store; procedure test is type T_Store is new T_Asbtract_Store with null record; =20 overriding procedure Insert (Store : in out T_Store; Client : in T_Client'Class) is begin null; end Insert; =20 A_Store : access T_Asbtract_Store; The_Store : aliased T_Store; Client : T_Client; begin A_Store :=3D T_Asbtract_Store (The_Store)'Access; A_Store.Insert (Client); end test; The compiler does not like "A_Store.Insert (Client)". Also with this construct I've to use an access variable ... Anyone can shed a light on this or suggest a smarter Ada way? Regards, Serge