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,db88d0444fafe8eb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g43g2000cwa.googlegroups.com!not-for-mail From: "Gene" Newsgroups: comp.lang.ada Subject: Re: Surprise in array concatenation Date: 5 Sep 2005 08:53:30 -0700 Organization: http://groups.google.com Message-ID: <1125935610.797293.40550@g43g2000cwa.googlegroups.com> References: <1125610942.747981.280770@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: 216.190.181.85 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1125935616 31464 127.0.0.1 (5 Sep 2005 15:53:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 5 Sep 2005 15:53:36 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g43g2000cwa.googlegroups.com; posting-host=216.190.181.85; posting-account=ZFTPUQ0AAABW8AYEou9RtrBd-zTxz0_y Xref: g2news1.google.com comp.lang.ada:4445 Date: 2005-09-05T08:53:30-07:00 List-Id: Thanks for a great discussion. I didn't say general array indexing is not useful; it obviously is. I said it's marginally useful in the literal (economist's) sense of "at the margin." A few illustrations... 1) If one had to give up a feature in order to get another, many would put general array indexing early on the chopping block. Between fixed and dynamic length arrays (and in particular bounded/unbounded strings), for example, Ada forces one to change from native array syntax to a procedural interface that hides re-sizing details. Ada programmers I know would happily give up general index ranges in order to get dynamically resizing arrays with native syntax---at least those who have worked in other languages where such are available. 2) General integer ranges for array indices are a half-hearted---at the margins---compromise wrt fully general arrays allowing any type as an index. In other words, if you put (A) 1-based arrays, (B) general discrete type array indices, and (C) fully general arrays on a conceptual scale, (B) lies _much_ closer to (A) than to (C). 3) The wonder of Ada is the predicatable, orthogonal way that syntax and semantics correspond. But we have just been observing that general integer array indexing leads to a not-very-predictable behavior in combination with slicing and catenation. If all arrays were 1-based, the problem could not have occurred. Hence this unhappy confluence of features, by conflicting with Ada's philosophy, is at the semantic margins of the language. It ought to be avoided if the goal is code with obvious meaning. E.g. after I re-coded my original example "properly" with 'First and 'Range to make its behavior correct, I quickly added a comment, -- 'First is not always 1. How marginally Ada! Again best regards to all and thanks for the discussion.