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: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: class wide iterable (and indexable) Date: Tue, 22 Jan 2019 18:04:41 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <2a6929c5-72fa-4d84-953a-44ea4597ab38@googlegroups.com> <75328dc5-fc59-4228-b77e-77ba6e5101c3@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 22 Jan 2019 17:04:42 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="d492b2497551ccfa65f0727761332e06"; logging-data="11291"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/uQ68xJMuihmLdlpGZDjHIHoX3pK47jmk=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 Cancel-Lock: sha1:RWnkAj6Up+uObJ1Amg8BdGForFA= In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:55325 Date: 2019-01-22T18:04:41+01:00 List-Id: On 1/22/19 12:15 AM, Randy Brukardt wrote: > > Moreover, in a new Ada-like language, it would make the most sense to > completely unify containers and arrays, which would mean that arrays would > be more like Vectors than like Ada arrays. For instance, in a Vector, the > lower bound is fixed for all values of a particular type. That would > eliminate a lot of programming errors that happen in Ada programs (many > programs fail to deal with unusual lower bounds, because it's hard to get > right). Ada has always had the ability to define array-like types with a fixed lower bound: type String_From_1 (Length : Natural) is record Value : String (1 .. Length); end record; I use such constructs when appropriate (in mathematics, for example, matrices and vectors have indices with lower values of 1, and a decent implementation should reflect and enforce that). One might argue that the reason they're not used more often is because of the value of having array types with variable lower bounds, but I doubt it. -- Jeff Carter "He didn't get that nose from playing ping-pong." Never Give a Sucker an Even Break 110