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,db88d0444fafe8eb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!border2.nntp.ams.giganews.com!nntp.giganews.com!news-in.superfeed.co.uk!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!newsfeed.kamp.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Surprise in array concatenation Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1125544603.561847.32140@g47g2000cwa.googlegroups.com> <14muavojz308w.1ouv7xin79rqu$.dlg@40tude.net> Date: Thu, 1 Sep 2005 20:06:21 +0200 Message-ID: NNTP-Posting-Date: 01 Sep 2005 20:05:52 MEST NNTP-Posting-Host: a0719214.newsread4.arcor-online.net X-Trace: DXC=AkM`QBS2:W2MXCiXZcgNO?:ejgIfPPld4jW\KbG]kaM8ea\9g\;7Nm5V;S21Jfl:R:[6LHn;2LCV>VVa[ZlQni_1f[5WGib8EW0 X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:4380 Date: 2005-09-01T20:05:52+02:00 List-Id: On 01 Sep 2005 12:04:17 -0400, Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > >> On 31 Aug 2005 20:16:43 -0700, Gene wrote: >> >>> Nonetheless the rule seems silly: When a leading zero-length array is >>> catenated to another array the result takes on the starting index of >>> the _second_ operand. This doesn't make sense to me. Why not use the >>> starting index of the zero-length array? >> >> Because that might be ill-defined, I guess. >> >> A more interesting question is why Empty'First does not raise any >> exception. > > Heh? You want this: > > procedure Put(S: String) is > begin > for I in S'First..S'Last loop -- equivalent to S'Range > Put_Char(S(I)); > > to crash when S = ""? Yes. It is in my view no different from Y := X / X; crashing when X=0. The former should be for I in S'Range loop -- is not equivalent to S'First..S'Last when S is "" The latter should be: Y := 1; -- is not equivalent to X / X when X is 0 >>... After all, there is no any lower bound of an empty index range. > > In Ada, every range, and every array, has both a lower and an upper > bound. That's exactly the problem! (:-)) >> Provided, that empty arrays are all same, of course. > > Depends on what you mean by "same". ;-) Different empty arrays can > have different bounds -- but "=" returns True! Ditto. Empty sets are indistinguishable. They have no identity. Ada's empty arrays are different with all nasty consequences of that. >>... If not, then another >> interesting question would appear: how to make an empty array with the >> lower bound Integer'First? > > You can't. Which is bad. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de