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,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d2ded6de39562f0e,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-22 18:44:01 PST From: "Alex Angas" Newsgroups: comp.lang.ada Subject: Instantiating a generic ADT from another ADT Date: Mon, 23 Apr 2001 09:44:34 +0930 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: ppp968.adelaide.on.net.au Message-ID: <3ae388e0@duster.adelaide.on.net> X-Trace: 23 Apr 2001 11:14:00 +0950, ppp968.adelaide.on.net.au Path: newsfeed.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!intgwpad.nntp.telstra.net!news1.optus.net.au!optus!yorrell.saard.net!duster.adelaide.on.net!ppp968.adelaide.on.net.au Xref: newsfeed.google.com comp.lang.ada:6842 Date: 2001-04-23T09:44:34+09:30 List-Id: Hey all, I'm having a great deal of trouble trying to instantiate a generic list package ADT (with generic functions) from another ADT (a hash table ADT). Can this even be done? I'm trying to create a linked list of hash tables. The problem is that I am declaring functions that use the as-yet undeclared type of hash_table_list. The compiler isn't happy about just saying that it's private so I tried to declare it at the end of the private section. Didn't work! Compiler also isn't very happy about declaring that function to be used by generic_list_package in the private section of hash_table.ads. I really don't know how to do this. Here's the code: *** hash_table.ads: with generic_list_package; package hash_table is type hash_table_list is private; function lookup(i : integer) return hash_table_list; ... private ... function get_key(i: in hash_table_entry) return integer; -- this is a generic function in generic_list_package package hash_table_list_package is new generic_list_package( item_type => hash_table_entry, key_type => integer); type hash_table_list is new hash_table_list_package.item_list; end hash_table; *** generic_list_package.ads: generic type item_type is private; -- type stored in list type key_type is private; -- type for comparing items in list with function get_key(item: in item_type) return key_type is <>; -- used for comparing keys package generic_list_package is type item_ptr is private; type item_list is limited private; .,. end generic_list_package; *** Any ideas?? Cheers, Alex.