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,30fad28eb8886cca X-Google-Attributes: gid103376,public From: mab@dst17.wdl.loral.com (Mark A Biggar) Subject: Re: parameterless generics? Date: 1996/07/15 Message-ID: <4seg48$o66@wdl1.wdl.lmco.com>#1/1 X-Deja-AN: 168429565 references: <4s48k9$3be$1@mhafn.production.compuserve.com> <4s4sns$nl4@map.mda.ca> organization: Loral Western Development Labs newsgroups: comp.lang.ada Date: 1996-07-15T00:00:00+00:00 List-Id: 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