Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: [JLS] new long[0][ -1 ] Date: Fri, 10 Jul 2015 16:43:06 -0400 Organization: A noiseless patient Spider Lines: 28 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 10 Jul 2015 20:41:47 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="8537"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/NK/8rhLDq+UWTkNgPZU9n" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 In-Reply-To: Cancel-Lock: sha1:b2EstrfiEk29tSBjf9OviHJQF84= Xref: csiph.com comp.lang.java.programmer:31986 On 7/10/2015 4:19 PM, Martin Gregorie wrote: > > Two features I'd have liked to see in Java are non-zero based arrays, e.g. > int temperatureOcurrences[-40:55] and flexible array bounds, e.g > int samples[0:flex] Would you mind elaborating on the latter? Java already has int flex = ...; int[] samples = new int[flex+1]; ... but do you mean something different? Do you mean, perhaps, that a subsequent assignment to `flex' would grow or shrink the array? What output would int flex = 5; int[] samples = new int[flex+1]; System.out.println(samples.length); flex = 20; System.out.println(samples.length); flex = -42; // NegativeArraySizeException? System.out.println(samples.length); generate? Would removing the `+1' change things materially? -- esosman@comcast-dot-net.invalid "Don't be afraid of work. Make work afraid of you." -- TLM