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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,91276ec2ea911d3f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Fri, 08 Sep 2006 20:27:57 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: Subject: Re: Generic procedures and their parameters Date: Fri, 8 Sep 2006 20:29:20 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Message-ID: <3aqdnWxXdPQDhZ_YnZ2dnUVZ_vmdnZ2d@megapath.net> NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-pR6ZC2IBEB0OfDjAzMFtm0EFrWBvQtN7XkneOPwnoKd0ZyajFsPTg3kGWLQtldyfirqUx6txxt6kMu2!vCDfV2dBpCsBs3LlrEUq+SibRZ05qTDCWnSbrqFaRn5F8YVpqLphPPsE/7tR8bJx1Pg3qIaoCsXg!Ix6jo+g5MYOy8w== X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:6529 Date: 2006-09-08T20:29:20-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:g3c05xzf7uad$.wucggq0h6wuy$.dlg@40tude.net... ... > Yes, that's when somebody wanted to have different orders. But that in my > view is a different case, in which "<" should be better passed to Sort as a > plain parameter, rather than generic or primitive subprogram. We considered that, too, and decided not to do it because it because it doesn't work well in Ada. "<" is usually Intrinsic, and Intrinsic things cannot be passed as access-to-subprogram parameters. So you'd have to explicitly build a wrapper function, with all of the possibilities for error that that exposes. Generic instantiations don't have that limitation (as they are are considered more heavyweight than a simple 'Access). > I think the difference between two scenarios is whether the order is arbitrary, ad-hoc > or else involved in some loose set of operations. In the first case "<" > should be a parameter in the latter case a part of the interface (be it > generic or primitive operation). We really wanted to avoid having a lot of different sorting routines, because that then forces users to decide which one that they need to use. Most of the time, the choice is not particularly important (if it is not a critical operation), and excess choices just take mental energy away from solving the problem at hand. (That's why I'd be opposed to having multiple kinds of lists [like doubly and singly linked] in the Ada Containers library; the space and performance differences would be slight, but they'd add an additional complexity to deciding what container to use.) But you are correct that there usually is a "natural" comparison operation and then secondary orderings -- one could consider these as different cases, simply as one would be named "<" and the other would have some other name.. Randy.