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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cee84258116182b5,start X-Google-Attributes: gid103376,public From: akonstan@news.cs.columbia.edu (Alexander V. Konstantinou) Subject: Formal Packages definition limitation Date: 1996/09/13 Message-ID: <51cofa$ku4@herald.cs.columbia.edu>#1/1 X-Deja-AN: 180490773 organization: Columbia University Department of Computer Science newsgroups: comp.lang.ada Date: 1996-09-13T00:00:00+00:00 List-Id: Consider a generic procedure Iter_Swap (swaps iterators) generic with package Iterators1 is new Forward_Iterators(<>); with package Iterators2 is new Forward_Iterators(<>); procedure Iter_Swap(A: Iterators1.Iterator; B: Iterators2.Iterator); Now, this definition is too general since I would like to restrict that Iterators1.Value_Type = Iterators2.Value_Type A reasonable way to do this (you can argue about the syntax) would be : generic with package Iterators1 is new Forward_Iterators(<>); with package Iterators2 is new Forward_Iterators (Value_Type=>Iterators1.Value_Type); procedure Iter_Swap(A: Iterators1.Iterator; B: Iterators2.Iterator); I'd want the compiler to accept any instantiation of Forward_Iterators with the limitation that its value type should be Iterators1.Value_Type. Alas the reference manual defines (Sec. 12.7): formal_package_actual_part ::= (<>) | [generic_actual_part] leaving no room for partial generic_actual_parts. Any ideas why this was not allowed ? At present I am forced to pass two conversion functions, but that is clearly not a good solution. Alexander V. Konstantinou akonstan@cs.columbia.edu -- -- Alexander V. Konstantinou http://www.cs.columbia.edu/~akonstan/ akonstan@cs.columbia.edu akonstan@acm.org