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: Wed, 23 Jan 2019 19:00:08 +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: Wed, 23 Jan 2019 18:00:08 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="9a710295b005357564007be648dedd07"; logging-data="18062"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+lCqi1BFZ9OeiMFJipEBAkXGu75+GKmJ4=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 Cancel-Lock: sha1:3ve36FvIhnaehuij4IPAdAG7Qt4= In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:55341 Date: 2019-01-23T19:00:08+01:00 List-Id: On 1/22/19 11:02 PM, Randy Brukardt wrote: > > They're not used more often because this fixes the length, and prevents > operations on items with different lengths. Again, a string is not an > array -- a Vector is a better model for a string. I suspect we're talking about 2 different things. The length is fixed just as it is for all array objects. I'm talking about a way to get arrays (current Ada meaning) with a fixed lower bound. Things with a variable length are something else altogether. I used String simply because it was a convenient array type to use in the example. This made the example easier to understand because it didn't need an extra type definition that is irrelevant to explaining the concept. I'm not discussing whether this is a useful implementation for strings. (A string is a sequence of characters, and one use of an array is sequences, so an array may be a suitable implementation for a string. I suspect many of your problems with strings are really problems with characters.) With all that understood (I hope), I can restate my question as: Why do those who use arrays, and have difficulty with them having variable lower bounds, not use such constructs more often instead? Is it because the value of having constant indices across slices outweighs the negatives of variable lower bounds? -- Jeff Carter "This scene's supposed to be in a saloon, but the censor cut it out. It'll play just as well this way." [in a soda fountain] Never Give a Sucker an Even Break 113