From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 16 Oct 92 22:51:15 GMT From: sun-barr!cs.utexas.edu!qt.cs.utexas.edu!news.Brown.EDU!noc.near.net!inmet !spock!stt@ames.arc.nasa.gov (Tucker Taft) Subject: Re: Generic Instantiation as Subprogram Body? (Clarification) Message-ID: <1992Oct16.225115.11359@inmet.camb.inmet.com> List-Id: In article dnsurber@lescsse.jsc.nasa.gov (Douglas N. Surber) writes: > . . . >There does not appear to be any clean way to use an instance of a >generic as the implementation of a subroutine declared in a package spec >without putting the instantiation in the spec itself. If for some >reason I wanted to implement a subroutine in that fashion, I wouldn't >want that to be part of the spec. It is an implementation detail and >doesn't belong in the spec. So, three questions: > >1) Is there anyway to do this other than the kludges I listed in my > original posting? > >2) If not, what was the rationale behind this restriction? > >3) Has this been fixed in Ada 9X? Well, yes and no. The current 9X proposals allow the body of a subprogram to be a rename, including a rename of an instantiation. For readability and consistency reasons the body may not be an instantiation itself, since an instantiation does not repeat the parameter profile, so correlating it with the specification that it is implementing is a potentially error-prone process in the presence of overloading. Admittedly, allowing renames of instantiations but not instantiations themselves seems a little arbitrary, and we welcome comments on this issue if there are strong feelings either way. >Once again, I know lots of ways to implement relations, I am trying to >understand a glitch in the language definition that improperly couples >the specification of a package with its implementation. > >Douglas Surber >Lockheed >Houston, TX S. Tucker Taft stt@inmet.com Ada 9X Mapping/Revision Team Intermetrics, Inc. Cambridge, MA