comp.lang.ada
 help / color / mirror / Atom feed
From: mab@dst17.wdl.loral.com (Mark A Biggar)
Subject: Re: parameterless generics?
Date: 1996/07/15
Date: 1996-07-15T00:00:00+00:00	[thread overview]
Message-ID: <4seg48$o66@wdl1.wdl.lmco.com> (raw)
In-Reply-To: 4s4sns$nl4@map.mda.ca


In article <4s4sns$nl4@map.mda.ca> blaak@mda.ca (Ray Blaak) writes:
>Brian Gilbert <71413.1453@CompuServe.COM> writes:
>>Does anybody have a reason to use a generic (package or 
>>subprogram) without a parameter?  The language (Ada 83 at least) 
>>seems to allow it, but everytime the generic is instantiated it 
>>would produce an identical copy.  Comments?

Generic Child Units in Ada95 will almost always be like this

>Another possible reason is to make functionality "active" only when you need
>it. Consider:
>
>package Entity is
>  type Object is private;
>
>  procedure Low_Impact_Operation (On_The_Object : in out Object);
>
>  generic
>  package Fancy_Processing_Involving_A_Huge_Link_Enclosure is
>    procedure Do_It_At_Your_Own_Risk (To_Me : in out Object);
>  end Fancy_Processing_Involving_A_Huge_Link_Enclosure;
>end Entity;
>It could be that one application (say offline report generation) only needs a
>few features and a small link enclosure. The real system might be involved in a
>complex architecture with a large link enclosure. By having the extra
>operations in a generic, there should be no executable code generated for it
>until instantiation. This would be dependent on how you wrote the generic and
>how the compiler implements generics.

This usage is of course complete subsumed by Child Packages.

--
Mark Biggar
mab@wdl.lmco.com






  reply	other threads:[~1996-07-15  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-12  0:00 parameterless generics? Brian Gilbert
1996-07-11  0:00 ` Laurent Guerby
1996-07-11  0:00 ` Ray Blaak
1996-07-15  0:00   ` Mark A Biggar [this message]
1996-07-12  0:00 ` Robert Dewar
1996-07-22  0:00   ` Mats Weber
1996-07-12  0:00 ` Philip Brashear
1996-07-12  0:00 ` Theodore E. Dennison
1996-07-14  0:00 ` Norman H. Cohen
1996-07-15  0:00 ` Chris Papademetrious
1996-07-17  0:00   ` Richard Riehle
1996-07-18  0:00 ` Martin Lorentzon
replies disabled

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