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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9d94f0df6c6ef540,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-04 14:30:19 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!snoopy.risq.qc.ca!iad-peer.news.verio.net!news.verio.net!iad-read.news.verio.net.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Glueing using Generic Units From: Fingertip User-Agent: Xnews/5.04.25 X-NNTP-Posting-Host: line102-246.adsl.actcom.co.il Message-ID: Date: Sun, 04 May 2003 21:30:17 GMT NNTP-Posting-Host: 192.114.47.10 X-Complaints-To: abuse@verio.net X-Trace: iad-read.news.verio.net 1052083817 192.114.47.10 (Sun, 04 May 2003 21:30:17 GMT) NNTP-Posting-Date: Sun, 04 May 2003 21:30:17 GMT Organization: Verio Xref: archiver1.google.com comp.lang.ada:36942 Date: 2003-05-04T21:30:17+00:00 List-Id: Hey everyone! I'm interested in creating a generic package that is really flexible. What I mean is that instead of importing another package using a 'with' clause, which binds me to a certain interface of the 'with'ed unit, I want to glue the units together with a generic interface. (As far as I know, this is a known and acceptable technique) For example, my package requires a hash table and search tree, so I create these two interface packages: generic type hash_item_type is private; with procedure add... with procedure find... -- et cetra package hash_interface is end hash_interface; Now I can create a generic implementaion of my package, independant of any special implementation of the two data structures: generic with package Hash is new hash_interface (<>); with package Tree is new tree_interface (<>); package My_Package is -- end My_Package; Now comes my question: In this definition set, the two generic package parameters are disjoint. That is, I gave no restriction on their parameters. However, sometimes I'd want to restrict the generic parameters a little bit, for example, demand that Hash and Tree will store the same data type. This kind of thing should look like: generic type item_type is private; with package Hash is new hash_interface (hash_item_type => item_type); with package Tree is new tree_interface (tree_item_type => item_type); package ... But, of course, this declaration is incomplete, since if I already started supplying generic parameters, I have to specify them all, which is unwanted. So, my question (finally!) is: Is it possible to do what I want, or am I trying the wrong thing in Ada? Thanks in advance, Fingertip