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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f0a123883ff0cb0f X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.80.166 with SMTP id s6mr4634466pax.30.1349761549899; Mon, 08 Oct 2012 22:45:49 -0700 (PDT) Received: by 10.68.204.134 with SMTP id ky6mr4882725pbc.1.1349761549884; Mon, 08 Oct 2012 22:45:49 -0700 (PDT) Path: t10ni23613332pbh.0!nntp.google.com!kt20no15821392pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 8 Oct 2012 22:45:49 -0700 (PDT) In-Reply-To: <80f9a7cb-47fc-4573-9e2d-4efbe919416d@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 69.20.190.126 References: <86a6f9d1-c99f-4184-aa79-ab7c15af9d4c@googlegroups.com> <80f9a7cb-47fc-4573-9e2d-4efbe919416d@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: API design considerations - variable-length array in record type From: Shark8 Injection-Date: Tue, 09 Oct 2012 05:45:49 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-10-08T22:45:49-07:00 List-Id: On Monday, October 8, 2012 11:16:28 PM UTC-6, Adam Beneschan wrote: >=20 > Note that this will not work on all implementations. There are two ways = to implement an array component whose bound depends on a discriminant: (1) = the record type will contain space for the largest possible array, or=20 I think that's only an issue if the discriminant itself has a default value= . (Something to do with view-changing, now that you mention this possible pro= blem.) > (Other methods are possible in theory.) I'd like to know what those theories are. > (P.S. Is it just me, or is anyone else irritated by the use of Natural'Fi= rst or Positive'First? =20 I'm more irritated there's no 'type attribute so you can't say something li= ke Type K( X : Enum_21:=3D X'Type'First ) [...] for specifying that you do = want the type to have a defaulted discriminant, and that should be the 'Fir= st of that type. {After-all the type of X has to be known at compile-time.}= Though that particular example might not be the best; using X before it's = declaration is illegal. -- Though the idea could be useful other places. > if you have a subtype S, you should usually say S'First instead of coding= the literal value, because who knows what reason you might have in the fut= ure for deciding to change the declaration of S, and then you only have to = change it in one place. But I don't see the point of Natural'First. It wi= ll always be 0, on all implementations, and can never be changed no matter = how many times you redesign your program, so why not just write 0? OK, tha= t's my one rant for the day.) I usually do it to remind myself that I'm dealing w/ subtypes. {That is, it= helps me to think in terms of sets/subsets.}