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.68.211.38 with SMTP id mz6mr3178094pbc.1.1330546072966; Wed, 29 Feb 2012 12:07:52 -0800 (PST) Path: h9ni24043pbe.0!nntp.google.com!news2.google.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Array Help? Date: Wed, 29 Feb 2012 21:07:45 +0100 Organization: cbb software GmbH Message-ID: References: <10615783-d4a9-4cbd-8971-53ba1100d6a0@b18g2000vbz.googlegroups.com> <17412419.40.1330534213855.JavaMail.geo-discussion-forums@vbva11> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: 8edaRKIZlBsSkEaKtLmKVQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-02-29T21:07:45+01:00 List-Id: On Wed, 29 Feb 2012 13:24:10 -0500, Robert A Duff wrote: > Ludovic Brenta writes: > >> Doesn't that preclude slices that don't start at 'First? > > Yes. Too bad, yet another source of silly exceptions. >> Supposing your declarations, can you call >> >> procedure Foo (Param : in out Integer_Array); >> >> like this: >> >> declare >> A : Integer_Array (1 .. 10) := (others => 0); >> begin >> Foo (A (3 .. 8)); >> end; >> >> ? > > That will raise C_E. IMHO, that's a language design flaw -- inside > Foo, Param'First ought to be 1. Nope. Consider index of an enumeration type. > The fact that Foo can see that > it came from a slice is a leak of abstraction. There is no leak, but a misuse of a cardinal index as if it were ordinal number. This is typical for broken languages like C, but Ada was always better. What you want is something like: A (Index_Type'Val (1)) -- The first element of A rather than A (1) -- The element of A at the position corresponding to 1 Probably, the language should have a special syntax for that. Beloved [] brackets could suffice for the job: A [] could denote the array element by its position rather than by the index. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de