Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31980
| Path | csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: [JLS] new long[0][ -1 ] |
| Date | Fri, 10 Jul 2015 09:45:25 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 49 |
| Message-ID | <mnoi74$8pm$1@dont-email.me> (permalink) |
| References | <slrnmpvci8.uoi.avl@login.logic.tuwien.ac.at> <mnoc71$jah$1@dont-email.me> <slrnmpvgdg.uoi.avl@login.logic.tuwien.ac.at> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Fri, 10 Jul 2015 13:44:04 +0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="9014"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+S8tKdQc3bjOjc3c5HkfnG" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 |
| In-Reply-To | <slrnmpvgdg.uoi.avl@login.logic.tuwien.ac.at> |
| Cancel-Lock | sha1:GUup6MQNUPt+DLAXWiDW5mty4sY= |
| Xref | csiph.com comp.lang.java.programmer:31980 |
Show key headers only | View raw
On 7/10/2015 8:58 AM, Andreas Leitgeb wrote:
> Eric Sosman <esosman@comcast-dot-net.invalid> wrote:
>> On 7/10/2015 7:52 AM, Andreas Leitgeb wrote:
>>> I've had a look at the JLS to find out about the more or less special
>>> case of a 2-dimensional array, whose first(outer) dimension is 0, but
>>> I didn't find any extra mention of that case.
>>>
>>> From what I read, it would evaluate *all* the dimensions, then check
>>> if any of them is negative.
>>>
>>> But if first dimension is 0, then the loop shown in the "equivalent as"-
>>> code sample would not get its body run even once, so actually it wouldn't
>>> even notice if any of the further dimensions was negative.
>>>
>>> What would be an accurate *purely JLS-based* prediction for
>>> new long[0][-1]
>>> (not caring about actual existing JVM implementations) ?
>>
>> Intriguing question, but easily answered. 15.10.2, second
>> bullet, second sub-bullet:
>>
>> "Next, the values of the dimension expressions are checked.
>> If the value of any DimExpr expression is less than zero,
>> then a NegativeArraySizeException is thrown."
>
> My mistake was to generalize the first example in 15.10.1-2 .
>
> On second thought, the equivalence in the example-block is correct.
> It just cannot be generalized from dimensions 3,3 to "any" (like 0,-1),
> as for dims 0,-1 the compact form has to throw a NASE, while the
> alternative code doesn't.
>
> Thanks. Knot in my brain dissolved. :-)
You're welcome. But contemplating the uses of an array with
fewer than zero elements has tied what remains of my brain in a
knot that may not dissolve until my brain itself does ... :-)
<off-topic> What use might we make of a minus-sized array?
Perhaps it could model the old joke about a biologist, an engineer,
and a mathematician at a sidewalk cafe. They see two people enter a
building across the street, and a little later three people emerge.
"They have reproduced," says the biologist. "Observational error,"
says the engineer. And the mathematician observes "If somebody now
goes inside, the building will be empty." </off-topic>
--
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