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,c703c7ba8401cbb6 X-Google-Attributes: gid103376,public From: Ehud Lamm Subject: Re: signatures Date: 1999/08/01 Message-ID: #1/1 X-Deja-AN: 507427475 References: Content-Type: TEXT/PLAIN; charset=US-ASCII Organization: The hebrew University of Jerusalem Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-08-01T00:00:00+00:00 List-Id: On Thu, 29 Jul 1999, Brian Rogoff wrote: |My preferred way would be | |generic | type Item_Type is private; | type List_Type is array(Positive range <>) of Item_Type; |with procedure Sort(S : in out List_Type) is <>; |package Sort_Signature is end; | |then instantiate this with some types and a sort procedure. Yes, this seems like the natural way. But I don't like the idea of coding a sort routine, which may not be conforming, and only thn using it to instantiate a package, just to ensure the signature conformance. Am I missing something/is theere an easier way? |You can use |this package as a package parameter to an implementation package like the |following. | |generic | with My_Sort is new Sort_Signature(<>); |package My_Package is |... etc | |A very nice addition to Ada over Ada-83, these package parameters and |signature packages! | Indeed, and you can also code a package to be an instantiation! Like this (from GNAT): with Ada.Numerics.Long_Complex_Types with Ada.Numerics.Generic_Complex_Elementary_Functions package Ada.Numerics.Long_Complex_Elementary_Functions is new Ada.Numerics.Generic_Complex_Elementary_Functions (Ada.Numerics.Long_Complex_Types) Ehud Lamm mslamm@pluto.mscc.huji.ac.il http://purl.oclc.org/NET/ehudlamm <== My home on the web