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!reader02.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Community Input for the Maintenance and Revision of the Ada Programming Language Date: Sat, 9 Sep 2017 00:13:57 +0200 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <4dc188de-802b-41ad-9cdd-b8246eb9a1c7@googlegroups.com> <47cc6474-8b75-4644-92d0-bd1f694c20e7@googlegroups.com> <338b355a-dee4-4c73-b00e-09d9a8430fb1@googlegroups.com> <21692daf-5a52-43f0-a72a-d79e6a7dcc9f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 8 Sep 2017 22:14:07 -0000 (UTC) Injection-Info: reader.eternal-september.org; posting-host="59ba9f22e905782d4ba8dd245fe0838d"; logging-data="10950"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19j4eXnAr1c4nwnTFMFH6ffFCaWyIk88m0=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 In-Reply-To: <21692daf-5a52-43f0-a72a-d79e6a7dcc9f@googlegroups.com> Content-Language: en-US Cancel-Lock: sha1:ubuakZ7lCSUsYfPlD/JsiZpJDEU= Xref: news.eternal-september.org comp.lang.ada:47987 Date: 2017-09-09T00:13:57+02:00 List-Id: On 09/08/2017 11:04 PM, Johan Söderlind Åström wrote: > > Copy the entirety of an array is not insignificant, it is doubling the memory footprint which is not less. Unless a single array is effectively the entire memory usage of your program, copying a single array is hardly "doubling the memory footprint". For most programs, it is, in fact, an insignificant increase in the memory usage of the program. > A (I) + B (I) is more simpler than A (A'First + I) + B (B'First + I) to read. No, A (I) + B (I) is less simple, because it doesn't mean A (I) + B (I), it really means Real_A (Real_A'First + I) + Real_B (Real_B'First + I), and the reader has to remember that to understand what the code is doing. The more the reader has to remember, the greater the cognitive load of the code, and a significant part of S/W engineering is aimed at reducing the cognitive load. If you write Real_A (Real_A'First + I) + Real_B (Real_B'First + I) then the code actually does what it says and you haven't increased the cognitive load. But even better is a common paradigm for when you have to mix arrays with mis-matched index ranges (which should not be common). A common paradigm is well enough understood by most readers that it doesn't increase the difficulty of understanding the code. In my experience, in Ada, that paradigm is for i in A'range loop ... A (I) + B (I + B'First - A'First); > No copy is more simpler than a copy. Again, if a copy is easier to understand than the machinations needed to avoid a copy, then a copy is simpler. This is especially true when the machinations are not portable and someone has to understand why the code no longer works. > > So the simplest way to access a element in Ada is to write: > A : Integer_Array (-5 .. 5); > A (A'First + I); No, the simplest way is to write A (I) > I would really like to write, for a example: > (A (I) + B (I)) * C (I) / (D (I) ** E (I)); > instead of: > (A (A'First + I) + B (B'First + I)) * C (C'First + I) / (D (D'First + I) ** E (E'First + I)); The real question here is why the design has all these parallel arrays with the same length but different index ranges. -- Jeff Carter "[M]any were collected near them, ... to enjoy the sight of a dead young lady, nay, two dead young ladies, for it proved twice as fine as the first report." Persuasion 155