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 X-Google-Thread: 103376,8e7ac81a215f128c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Using Red-Black Trees Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <2419e829-6f45-4075-9005-b9876beb8aaa@r6g2000vbf.googlegroups.com> <46306fd9-21dc-40df-88e7-fc7e568399a4@k11g2000vbf.googlegroups.com> <1g4kzlu0ma9k7$.1t1gq0uvi1a5y.dlg@40tude.net> Date: Thu, 18 Nov 2010 14:23:21 +0100 Message-ID: <1jy4lbxhzs92x$.1g7lngcn418vy.dlg@40tude.net> NNTP-Posting-Date: 18 Nov 2010 14:23:21 CET NNTP-Posting-Host: 14fb781d.newsspool2.arcor-online.net X-Trace: DXC=`]UF\BR]_ On Thu, 18 Nov 2010 13:36:57 +0100, J-P. Rosen wrote: > Le 18/11/2010 10:02, Dmitry A. Kazakov a �crit : >>> Provide two packages with identical (or compatible enough for your >>> purpose) specifications: >>> >>> package Binary_Tree is.... >>> package Linked_List is.... >>> >>> Then declare at library level: >>> with Binary_Tree; >>> package My_Structure renames Binary_Tree; >> >> Yes of course it is a simple, but non-Ada solution. BTW, I am using it for >> years, with a small addition that the implementation is selected by the >> gpr-file. >> >> But it is not Ada it is pure C, because nothing is checked. > Come on, any incorrect usage will not compile! So is any incorrect usage of a C++ template. It is exactly the same use case. The point is that the implementation shall be checked when compiled, separately from the instantiation/use point(s). > You may argue that it would be nice to check that both structures are > compatible, but I challenge you to define the compatibility rules for > packages. In practice, two packages are compatible if the *user* uses > only compatible subprograms from both... Rules similar to ones for matching formal generic parameters should suffice. I don't think this is a problem. What is a potential problem is children packages, i.e. children of abstract packages vs. children of their implementations and how they mess up with each other. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de