Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 18 Aug 2011 08:34:16 -0500 Date: Thu, 18 Aug 2011 06:34:14 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: enhance an array's static type by a lower length-bound. References: <6k7p47d9442mcld6j2p5l4hekodard6oss@4ax.com> <4c11ff9c-3c83-45cc-85a7-9b0c05de17ff@glegroupsg2000goo.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 25 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 70.230.203.65 X-Trace: sv3-b9Wtb1p+B1v7nSjpTYmoP8a5ViWrTfWaf5SyJEMA7+ErppbrwjH2Z0KcEnJS/538y140DbEHTQr72Uy!nIRdhpbSsJpWBFx9D933DBCiR1MlZSYLvozy5ZAGK1eNWtPsarz1yW5Befj6fP3uq3shkPFAxEWu!o25xlgc09Crt7HALquZqbPn5EeBjwxK5Ajl1tV43Iu2Pow== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2557 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7216 On 8/18/2011 3:41 AM, Andreas Leitgeb wrote: > Unfortunately, Roedy completely misunderstood what my post was about. > > It was not about lower-bounding the indices, but about lower-bounding > the *length* - thus morphing certain runtime-ArrayIndexOutOfBoundExceptions > into compile-time errors. Are my postings really that hard to grasp? > Even the examples I provided? I think the confusion may have arisen because a lot of us are familiar with specified index lower bounds from the languages we know that implement them. I don't think I've ever seen a language with dynamic array creation that has a lower bound on the length of an array a variable can reference. I'm not sure how it would work, or how I would use it. Usually, if I have a non-zero lower length bound it is 1 or 2, but most of my array handling code is designed and tested for zero length and up. Even when there is a lower bound, I'm not sure knowing it would help much with compile time error detection. For example, a method to calculate the sample mean of some observations requires at least one element, but is going to iterate over the whole array. Patricia