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,a846a32ebf7c9dc6,start X-Google-Attributes: gid103376,public From: Brian Rogoff Subject: Generic formal package parameter question Date: 1997/08/21 Message-ID: #1/1 X-Deja-AN: 267819422 Newsgroups: comp.lang.ada Date: 1997-08-21T00:00:00+00:00 List-Id: There are two forms for generic formal package parameters with package P is new G(<>); or with package P is new G( Q1, Q2, ..., QN ); Why there isn't an intermediate form where some, but not necessarily all, of the parameters appear in the parameter list, allowing us to better represent the relationships between the parameters? For example, suppose we have two generic signature packages, Assignable and Composable generic type Assignable_Type is limited private; with procedure Assign( From : in out Assignable_Type; To : out Assignable_Type ); package Assignable is end; generic type Comparable_Type is limited private; with function Compare ( X, Y : Comparable_Type ) return Comparison_Type; -- Boolean or three-valued package Comparable is end; and we want a third package to have a generic formal parameter which is both Assignable and Comparable. I'd like to be able to express it like this generic type Value_Type is private; with package Comparable_Values is new Comparable( Value_Type, <> ); -- Illegal with package Assignable_Values is new Assignable( Value_Type, <> ); -- Illegal package Assignable_Comparable is end; but Ada forces an all or nothing approach here, and I have to choose nothing (<>) rather than be able to express those constraints that I can, in this case that both of the signature packages are instantiated with Value_Type. This seems really against the spirit of Ada to me, so I'm curious as to the reasons for this limitation. -- Brian