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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3d6e3f68a9ab5a3c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-12 05:48:16 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!news.tufts.edu!uunet!dca.uu.net!ash.uu.net!spool0902.news.uu.net!not-for-mail Date: Tue, 12 Nov 2002 08:48:13 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2b) Gecko/20021105 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Charles: Generic_Find References: <3dd082fe$0$307$bed64819@news.gradwell.net> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1037108893.573381@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@nightcrawler.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1037108894 21037 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:30759 Date: 2002-11-12T08:48:13-05:00 List-Id: Preben Randhol wrote: > Victor Porton wrote: >>Why Generic_Find is generic? Why not just pass the predicate >>as a function access? Doing so would avoid the need of >>generic instantiation. > > Doesn't sound to me like a good Ada solution to do that. Sounds more > like C++ Hey! VP is commenting on Charles, which is based on the C++ STL, whose version of find is a template. The C++ standard library uses generic instantiation almost everywhere. Anyway, in C++ the reason to have the predicate be generic is the many varieties of objects that can stand in for a predicate. It also introduces potentially significant optimization opportunities, since for predicates, function call overhead can easily dwarf the amount of computation done by the predicate itself.