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.50.169.33 with SMTP id ab1mr9302374igc.1.1330539851105; Wed, 29 Feb 2012 10:24:11 -0800 (PST) Path: h9ni23770pbe.0!nntp.google.com!news2.google.com!news.glorb.com!solaris.cc.vt.edu!news.vt.edu!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Array Help? Date: Wed, 29 Feb 2012 13:24:10 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <10615783-d4a9-4cbd-8971-53ba1100d6a0@b18g2000vbz.googlegroups.com> <17412419.40.1330534213855.JavaMail.geo-discussion-forums@vbva11> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1330539850 12220 192.74.137.71 (29 Feb 2012 18:24:10 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 29 Feb 2012 18:24:10 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:ojDIiDFNjWUBKqxe1DIQ7ofnawA= Content-Type: text/plain; charset=us-ascii Date: 2012-02-29T13:24:10-05:00 List-Id: Ludovic Brenta writes: > Doesn't that preclude slices that don't start at 'First? Yes. > 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. The fact that Foo can see that it came from a slice is a leak of abstraction. The fact that arrays slide in many situations is proof that people don't really care too much about the bounds -- they care about the length. Anyway, slices aren't really all that useful -- for many array types, you don't need them at all. And slices as l-values, as in your example, are quite rare, because you really want to be able to change the length of the slice, if you want to change it at all. The following won't work: X : String := "Hello, world."; X(1..5) := "Goodbye"; -- raises C_E - Bob