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-Thread: 103376,2ac407a2a34565a9 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.204.131.75 with SMTP id w11mr591431bks.0.1331797837733; Thu, 15 Mar 2012 00:50:37 -0700 (PDT) Path: h15ni2443bkw.0!nntp.google.com!news2.google.com!news3.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!195.96.0.7.MISMATCH!newsfeed.utanet.at!newsfeed.tele2net.at!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!news.uni-weimar.de!not-for-mail From: stefan-lucks@see-the.signature Newsgroups: comp.lang.ada Subject: Re: Array Help? Date: Thu, 15 Mar 2012 08:46:16 +0100 Organization: Bauhaus-Universitaet Weimar Message-ID: References: <10615783-d4a9-4cbd-8971-53ba1100d6a0@b18g2000vbz.googlegroups.com> <17412419.40.1330534213855.JavaMail.geo-discussion-forums@vbva11> Reply-To: stefan-lucks@see-the.signature NNTP-Posting-Host: medsec1.medien.uni-weimar.de Mime-Version: 1.0 X-Trace: tigger.scc.uni-weimar.de 1331797837 24878 141.54.178.228 (15 Mar 2012 07:50:37 GMT) X-Complaints-To: news@tigger.scc.uni-weimar.de NNTP-Posting-Date: Thu, 15 Mar 2012 07:50:37 +0000 (UTC) X-X-Sender: lucks@medsec1.medien.uni-weimar.de In-Reply-To: Content-Type: TEXT/PLAIN; charset=US-ASCII Date: 2012-03-15T08:46:16+01:00 List-Id: On Wed, 14 Mar 2012, BrianG wrote: > 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)? Good catch! I actually meant Positive'First. -- ---- Stefan.Lucks (at) uni-weimar.de, University of Weimar, Germany ---- ------ I love the taste of Cryptanalysis in the morning! ------