comp.lang.ada
 help / color / mirror / Atom feed
From: Ehud Lamm <mslamm@mscc.huji.ac.il>
Subject: Re: signatures
Date: 1999/08/01
Date: 1999-08-01T00:00:00+00:00	[thread overview]
Message-ID: <Pine.A41.3.96-heb-2.07.990801004138.118920C-100000@pluto.mscc.huji.ac.il> (raw)
In-Reply-To: Pine.BSF.4.10.9907292015080.15361-100000@shell5.ba.best.com

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







  reply	other threads:[~1999-08-01  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-29  0:00 signatures Ehud Lamm
1999-07-29  0:00 ` signatures Brian Rogoff
1999-08-01  0:00   ` Ehud Lamm [this message]
1999-08-01  0:00     ` signatures James S. Rogers
1999-08-01  0:00       ` signatures Brian Rogoff
  -- strict thread matches above, loose matches on Subject: below --
1988-12-07 16:36 signatures Stephe Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox