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,2ac407a2a34565a9 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.235.4 with SMTP id ui4mr3623320pbc.3.1331327448461; Fri, 09 Mar 2012 13:10:48 -0800 (PST) MIME-Version: 1.0 Path: h9ni7576pbe.0!nntp.google.com!news2.google.com!goblin1!goblin2!goblin.stu.neva.ru!news.stack.nl!nuzba.szn.dk!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Array Help? Date: Fri, 9 Mar 2012 15:10:39 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <10615783-d4a9-4cbd-8971-53ba1100d6a0@b18g2000vbz.googlegroups.com> <17412419.40.1330534213855.JavaMail.geo-discussion-forums@vbva11> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1331327446 26901 69.95.181.76 (9 Mar 2012 21:10:46 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 9 Mar 2012 21:10:46 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2012-03-09T15:10:39-06:00 List-Id: wrote in message news:Pine.LNX.4.64.1203090923440.19986@medsec1.medien.uni-weimar.de... > On Thu, 8 Mar 2012, Randy Brukardt wrote: ... > Sorry for using anonymous arrays. I hardly ever do this in real > code. Please change the above code to > > generic > type Element_Type is (<>); > type Collection_Type is array(generic Positive range <>) of > Element_Type; > with function "<"(Left, Right : Element_Type) return Boolean is <>; > function Sort(Items : Collection_Type) return Collection_Type; > > The issue is the same: > >> > Sort(X) should be callable if the index type of X is any discrete type, >> > except when the index type is too large (i.e., X has more than >> > Positive'Last elements). Which as I said doesn't make sense: Positive is numeric; if you want any discrete type for the index you have to say so: generic type Element_Type is (<>); -- Really ought to be "is private". type Index_Type is (<>); type Collection_Type is array(Index_Type range <>) of Element_Type; with function "<"(Left, Right : Element_Type) return Boolean is <>; function Sort(Items : Collection_Type) return Collection_Type; This works now (and has since Ada 83!), so I fail to see exactly what your proposal gains (other than a bit less typing, and Ada have never been about saving typing). Randy.