comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Using Red-Black Trees
Date: Thu, 18 Nov 2010 14:23:21 +0100
Date: 2010-11-18T14:23:21+01:00	[thread overview]
Message-ID: <1jy4lbxhzs92x$.1g7lngcn418vy.dlg@40tude.net> (raw)
In-Reply-To: ic36lg$799$1@news.eternal-september.org

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



  reply	other threads:[~2010-11-18 13:23 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-13 11:20 Using Red-Black Trees Björn
2010-11-13 12:14 ` Phil Thornley
2010-11-13 13:10 ` Alex Mentis
2010-11-13 13:23   ` Björn
2010-11-13 13:53     ` Alex Mentis
2010-11-13 14:06       ` Björn
2010-11-13 16:31       ` Simon Wright
2010-11-15  8:49   ` Stephane Carrez
2010-11-15 15:32     ` John B. Matthews
2010-11-15 22:46   ` Randy Brukardt
2010-11-16 16:10     ` Gene
2010-11-16 17:17       ` Alex Mentis
2010-11-16 19:51         ` Randy Brukardt
2010-11-16 21:24           ` Colin Paul Gloster
2010-11-17  2:50           ` Alex Mentis
2010-11-17  5:10             ` Adam Beneschan
2010-11-17 22:59               ` Yannick Duchêne (Hibou57)
2010-11-17 23:15                 ` Vinzent Hoefler
2010-11-17 23:39                   ` Yannick Duchêne (Hibou57)
2010-11-18  0:13                     ` Vinzent Hoefler
2010-11-18  6:27                     ` J-P. Rosen
2010-11-18  7:08                       ` Yannick Duchêne (Hibou57)
2010-11-18 10:47                         ` stefan-lucks
2010-11-18 10:45                           ` Yannick Duchêne (Hibou57)
2010-11-18  9:02                       ` Dmitry A. Kazakov
2010-11-18 12:36                         ` J-P. Rosen
2010-11-18 13:23                           ` Dmitry A. Kazakov [this message]
2010-11-17 22:38     ` Yannick Duchêne (Hibou57)
2010-11-13 21:53 ` Jeffrey Carter
2010-11-14  8:20   ` Björn
2010-11-14  8:37     ` Dmitry A. Kazakov
2010-11-13 23:51 ` robin
replies disabled

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