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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.ada Subject: Re: Latest suggestion for 202x Date: Mon, 17 Jun 2019 14:38:42 -0700 Organization: None to speak of Message-ID: References: <728c4668-8fa0-4a57-a502-2bf476fc3940@googlegroups.com> <4908c3e3-18dc-4953-bf26-46f160d2ebfd@googlegroups.com> <9dcf22a2-2255-4089-b1f0-93e31448415e@googlegroups.com> <86h88obeu0.fsf@gaheris.avalon.lan> <39e749cd-de5c-44fa-b8ec-50d36f3bd52c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="8ffe547a2f5c98c1a2fec950f6fd72f4"; logging-data="10369"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+rJhrcPPhEIOAY9gLYXgrH" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:cy3DfLrdKmfJAdldHD8S5x1V854= sha1:K8c1FAK/W3sRYeyTqwifAoffQKw= Xref: reader01.eternal-september.org comp.lang.ada:56667 Date: 2019-06-17T14:38:42-07:00 List-Id: "Dmitry A. Kazakov" writes: > On 2019-06-17 15:35, Maciej Sobczak wrote: [...] >> Yet, it's convenient to claim that Ada is consistent and readable, >> because it has round brackets for array indexing? > > Right, A(I,J) is far more readable than A[I][J]. That conflates two separate issues. In C (and many C-like languages), 2-dimensional arrays are simply arrays of arrays, which is why the syntax for accessing an element is A[I][J]. In Pascal, for example, 2-dimensional arrays are distinct from arrays of arrays, and an element of a 2D array can be accessed as A[I,J]. I don't see A(I,J) as being more readable than A[I,J]. Personally, I've always thought that Ada should have used square brackets for array indexing. I seem to recall that part of the rationale was that Ada might be used with character sets that don't include the '[' and ']' characters, including some variants of EBCDIC. But it's not that big a deal, and it's too late to change it. Introducing A[I] and removing the existing A(I) notation would break existing code, which would be unacceptable, and allowing both would be worse than allowing just one or the other. I'm not at all persuaded by the argument that array indexing is interchangeable with function calls. A(I) = 42; -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */