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-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Copying rows in a two dimensional array. Date: Mon, 08 Feb 2010 08:15:50 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1265634937 14112 192.74.137.71 (8 Feb 2010 13:15:37 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 8 Feb 2010 13:15:37 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:/8aS/M/ondZ3yAXwriIq1XfZkBk= Xref: g2news1.google.com comp.lang.ada:8976 Date: 2010-02-08T08:15:50-05:00 List-Id: tmoran@acm.org writes: >> Discriminated arrays would be more efficient than Ada's arrays. >> We would have: >> >> type String (Length : Natural) is >> array (Positive range 1..Length) of Character; > > How would you handle slices, either in assignments or as parameters? Sliding. All strings should start at 1, including slices. In Ada, if you do "P(X(5..10));" procedure P can see that the lower bound is 5. That's a break in the abstraction -- P shouldn't know or care where the string came from. If both bounds are constrained, then slices should be illegal. That is, "is array(1..10) of ..." should mean that ALL objects of that type have bounds exactly 1..10. Actually, slices are one of the least useful features of Ada. I wouldn't mind (much) if they didn't exist in the first place. - Bob