On Thu, 18 Nov 2010, Yannick Duch�ne (Hibou57) wrote: > 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). Why is that a big deal? The instance of a polymorphic data structure must somehow be told which operations to use, anyway. Here is, how it should look like (not checked by a compiler). ----------- The specification: generic procedure Insert(Container: in out Store; Key: Key_Type; Item: Payload; Did_Overwrite: out Boolean) procedure Lookup(Container: Store; Key: Key_Type; Item: out Payload; Found: out Boolean); procedure Delete(Container: in out Store; Key: Key_Type; Found: out Boolean); package Do_Something is ... end Do_Something; ----------- Two possible instantiations: package Do_Something_Simple is new Do_Something(Linked_List.Insert, Linked_List.Lookup, Linked_List.Delete); -- use a linked list as the internal data struture -- constant time insert, linear time lookup and delete package Do_Something_Fast is new Do_Something(AVL.Insert, AVL.Lookup, AVL.Delete); -- use an AVL tree, as the internal data structure -- logarithmic time for all of insert, lookup and delete To me, it seems that generics are quite good for eactly that purpose ... Stefan -- ------ Stefan Lucks -- Bauhaus-University Weimar -- Germany ------ Stefan dot Lucks at uni minus weimar dot de ------ I love the taste of Cryptanalysis in the morning! ------