Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31990
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: [JLS] new long[0][ -1 ] |
| Date | 2015-07-11 07:33 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <mnqurs$qn5$1@dont-email.me> (permalink) |
| References | (3 earlier) <mnoi74$8pm$1@dont-email.me> <slrnmpvl62.uoi.avl@login.logic.tuwien.ac.at> <mnp9cb$134$1@dont-email.me> <mnpamb$8ap$1@dont-email.me> <mnpgml$h0u$1@dont-email.me> |
On 7/10/2015 6:24 PM, Martin Gregorie wrote:
> On Fri, 10 Jul 2015 16:43:06 -0400, Eric Sosman wrote:
>
>> 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?
>>
> Brief pause while I found my Algol68R User Guide (I haven't used the
> language since 1977. I mean the latter, for instance the declaration
>
> [1:0 flex] real a; declares an array with flexible bounds and initially
> no elements. So I can do the following:
>
> a := (1.0, 2.0, 3.0); and somewhat later, I might do this:
> a := (0.0, 1.1, 2.2, 3.1415926, 22.0/7.0, 0.95);
>[...]
Java can do that:
double[] a = new double[0];
a = new double[] { 1.0, 2.0, 3.0 };
a = new double[] { 0.0, 1.1, 2.2, 3.1415926, 22.0/7.0, 0.95 };
Java can't, however, do the kind of slice-'n-dice operations you
mention, and it can't escape its zero-origin requirement.
Thanks for the explanation.
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[JLS] new long[0][ -1 ] Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2015-07-10 11:52 +0000
Re: [JLS] new long[0][ -1 ] Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-10 08:02 -0400
Re: [JLS] new long[0][ -1 ] Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2015-07-10 12:58 +0000
Re: [JLS] new long[0][ -1 ] Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-10 09:45 -0400
Re: [JLS] new long[0][ -1 ] Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2015-07-10 14:19 +0000
Re: [JLS] new long[0][ -1 ] Martin Gregorie <martin@address-in-sig.invalid> - 2015-07-10 20:19 +0000
Re: [JLS] new long[0][ -1 ] Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-10 16:43 -0400
Re: [JLS] new long[0][ -1 ] Martin Gregorie <martin@address-in-sig.invalid> - 2015-07-10 22:24 +0000
Re: [JLS] new long[0][ -1 ] Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-11 07:33 -0400
Re: [JLS] new long[0][ -1 ] Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2015-07-10 21:17 +0000
Re: [JLS] new long[0][ -1 ] Martin Gregorie <martin@address-in-sig.invalid> - 2015-07-10 22:29 +0000
Re: [JLS] new long[0][ -1 ] Arne Vajhøj <arne@vajhoej.dk> - 2015-07-27 22:10 -0400
Re: [JLS] new long[0][ -1 ] leif.roar@dimnakorr.com - 2015-07-28 01:53 -0500
Re: [JLS] new long[0][ -1 ] Arne Vajhøj <arne@vajhoej.dk> - 2015-07-28 19:13 -0400
Re: [JLS] new long[0][ -1 ] leif.roar@dimnakorr.com - 2015-07-28 21:50 -0500
Re: [JLS] new long[0][ -1 ] Martin Gregorie <martin@address-in-sig.invalid> - 2015-07-28 11:13 +0000
Re: [JLS] new long[0][ -1 ] Arne Vajhøj <arne@vajhoej.dk> - 2015-07-31 19:41 -0400
Re: [JLS] new long[0][ -1 ] Martin Gregorie <martin@address-in-sig.invalid> - 2015-08-01 10:23 +0000
Re: [JLS] new long[0][ -1 ] Joerg Meier <joergmmeier@arcor.de> - 2015-07-10 17:07 +0200
Re: [JLS] new long[0][ -1 ] Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2015-07-10 18:10 +0000
csiph-web