comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Using Red-Black Trees
Date: Thu, 18 Nov 2010 08:08:00 +0100
Date: 2010-11-18T08:08:00+01:00	[thread overview]
Message-ID: <op.vmct3mpqule2fv@garhos> (raw)
In-Reply-To: ic2h0f$g7$1@news.eternal-september.org

Le Thu, 18 Nov 2010 07:27:20 +0100, J-P. Rosen <rosen@adalog.fr> a écrit:

> Le 18/11/2010 00:39, Yannick Duchêne (Hibou57) a écrit :
>> You can have only one at a time. If you select an implementation, you
>> select it system-wide, and you cannot select one for that usage and
>> another for another usage in the same system.
>>
> If that's really what you want, there is an easy solution.
> 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;
>
> And then, use My_Structure all over the place. By changing two words in
> one two-line file, you can switch your entire project to the other
> implementation.
I know that one, but this is a workaround, not a language support (the so  
called “static polymorphism”). Formally speaking, you do not have multiple  
implementations of a single specification. The closest thing actually is  
generic package. But that is not easy to do with generics: you will have  
to give the generic instance all of its custom implementation via generic  
parameters (methods and others).


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.

“I am fluent in ASCII” [Warren 2010]



  reply	other threads:[~2010-11-18  7:08 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) [this message]
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
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