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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,189a28164788ed2e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-30 22:57:42 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.ems.psu.edu!news.cis.ohio-state.edu!news.maxwell.syr.edu!netnews.com!xfer02.netnews.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mail From: Richard Riehle Newsgroups: comp.lang.ada Subject: Re: Using "with function" Date: Tue, 30 Oct 2001 23:00:50 -0800 Organization: AdaWorks Software Engineering Message-ID: <3BDFA1A2.EAF8B6AA@adaworks.com> References: Reply-To: richard@adaworks.com NNTP-Posting-Host: 9e.fc.c5.47 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 31 Oct 2001 06:56:47 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:15464 Date: 2001-10-31T06:56:47+00:00 List-Id: Matthew Heaney wrote: > Also, in general, you should use default notation for generic formal > subprograms, like this: > > generic > type Element_Type is private; > with function "=" (L, R : Element_Type) return Boolean is <>; --say "is > box" > package GP is It is nice to hear from Matthew Heaney. He has been absent for far too long from this forum, and we always enjoy his comments. I am going to respectfully disagree with Matthew on this. While using the "box" makes it easier to instantiate the "with function" it also carries with it some danger. Both Booch and Ed Berard made the case many years ago for avoiding the use of operators directly in generic formal function parameters. In the GRACE components it was common to see somethin like this: generic type Element_Type is private; with function Is_Equal(L, R : Element_Type) return Boolean; package GP ... This has the effect of demanding that the instantiating unit supply a generic actual parameter. I recall a PhD thesis from Ohio State (apologize for forgetting the author's name) in which the case was made for making all generic formal parameters limited private and requiring the instantiation to provide all kinds of operations, including a copy procedure since assignment cannot be overloaded. Of course, now that we can create generic signature packages in Ada 95, that is packages that contain only generic formal parameters for further instantiation of generic formal package parameters, the Ohio State thesis gains a bit more credibility. Richard Riehle