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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: working with diferent instances of the same generic interface Date: Thu, 1 Oct 2015 21:29:09 +0200 Organization: cbb software GmbH Message-ID: <1qdvz5nsrt3yp.gmtykg9khnkm$.dlg@40tude.net> References: <625c79d2-f5ed-4cd4-80ea-ea310e381017@googlegroups.com> <87y4ggm71k.fsf@adaheads.sparre-andersen.dk> <157a8d0b-85ee-454f-a7cb-76b88ee8c474@googlegroups.com> <43ea52fd-3d08-417a-9f8a-842c366c151e@googlegroups.com> <38496571-a0b0-42d7-968e-c4436256deb0@googlegroups.com> <1wwp0hbqbyy25$.1oecxllxajsj5.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dZFZMi8Yw0yXeelTniGFpQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:27895 Date: 2015-10-01T21:29:09+02:00 List-Id: On Thu, 1 Oct 2015 09:45:46 -0700 (PDT), Aitor Alcrudo Sangros wrote: > I wanted to know if I could just do that ( use diferent instances of a > generic interface as if they had a common base type). "generic interface" means 1. a way to use a generic unit (to interface it) = not a type 2. a type, specifically an interface type declared within a generic unit. Considering #2 two interfaces have nothing in common unless they explicitly have a common base. It was already mentioned that the base can be a generic formal parameter, but it must be the same actual type to make instances from the generic related. > Just that the first solution that popped in my mind included the > generic parameter and wanted to know if it could be done. Parameter is no problem. There is no magic in generics (except for making programs unmaintainable). Consider each generic instance as a manually re-typed unit and then apply Ada rules to the result. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de