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.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no 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.135.231 with SMTP id pv7mr445989pbb.8.1331780130428; Wed, 14 Mar 2012 19:55:30 -0700 (PDT) Path: h9ni27368pbe.0!nntp.google.com!news2.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: BrianG Newsgroups: comp.lang.ada Subject: Re: Array Help? Date: Wed, 14 Mar 2012 22:55:27 -0400 Organization: A noiseless patient Spider Message-ID: References: <10615783-d4a9-4cbd-8971-53ba1100d6a0@b18g2000vbz.googlegroups.com> <17412419.40.1330534213855.JavaMail.geo-discussion-forums@vbva11> Mime-Version: 1.0 Injection-Date: Thu, 15 Mar 2012 02:55:29 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="AjcTBPVjSXIOmwAkWmr8nQ"; logging-data="21283"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1V0spXzug7UE381OL3hcq" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.24) Gecko/20111108 Thunderbird/3.1.16 In-Reply-To: Cancel-Lock: sha1:5pme3NjY4h9co/lEBxrZMN6ec0w= Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-03-14T22:55:27-04:00 List-Id: On 03/09/2012 03:48 AM, stefan-lucks@see-the.signature wrote: > On Thu, 8 Mar 2012, Randy Brukardt wrote: > [...] >> wrote: > >>> 1. Testing >>> >>> When you declare >>> >>> procedure Sort(Items: in out array(Positive range<>) of T) >> >> Let's hope you never do that, because anonymous types are the bane of Ada. >> And you surely can't do it today! > > OK, the real thing would look about like that: > > generic > type Element_Type is (<>); > type Index_Type is (Positive range<>); > 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; > >>> in a package specification, and you try to write a proper black-box test, >>> you need *more* test cases then when you do the same with another popular >>> language. >> >> Right. Bob's suggestion for some semi-constrained array subtype would fix >> that. But note that it was killed in Ada 95 in part because the >> implementation needed was essentially a record type with some sort of magic >> indexing. Which was a mess. > > Would it ease the implementation if you constrain the start index to some > fixed value, such as Index_Type'First? If that's what you want, why can't you (in this case) define that in your generic parameters, rather than an index range (which already has a defined type)? -- --- BrianG 000 @[Google's email domain] .com