Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #37608

Re: Every expression has a type?

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Every expression has a type?
Date Mon, 30 Oct 2017 09:05:47 -0400
Organization A noiseless patient Spider
Lines 46
Message-ID <ot783d$fq8$1@dont-email.me> (permalink)
References <Every-20171030130857@ram.dialup.fu-berlin.de>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Mon, 30 Oct 2017 13:05:49 -0000 (UTC)
Injection-Info reader02.eternal-september.org; posting-host="3c7c3db9946338fc63efa0fd9b8c0526"; logging-data="16200"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3PGBeSMEaishYvwOhyJov"
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0
In-Reply-To <Every-20171030130857@ram.dialup.fu-berlin.de>
Content-Language en-US
Cancel-Lock sha1:dPXqmuZmjAfbs3Rhf3GIhTrL5GM=
Xref csiph.com comp.lang.java.programmer:37608

Show key headers only | View raw


On 10/30/2017 8:29 AM, Stefan Ram wrote:
>    I was flabbergasted. I had made some handwritten notes
>    during my course, and one read:
> 
> _Jeder_ Ausdruck hat einen Typ.
> 
>    indicating that I wrote "Jeder Ausdruck hat einen Typ."
>    ("Every expression has a type.") in my published HTML
>    course notes, and that there was something wrong with
>    "Jeder" ("Every").
> 
>    But I can't remember what I was thinking of when I wrote
>    this. How can there be an expression in Java without a type?
>    So, eventually, I discarded my note.
> 
>    Still, I was wondering ...
> 
>    Then it struck my mind!
> 
>    The JLS says:
> 
>        THE Java programming language is a statically typed
>        language, which means that every variable and every
>        expression has a type that is known at compile time.
> 
>    But what's the type of a call of a method with the result
>    (jls9:8.4.5) »void«?
> 
>    In Java, »void« is not a type!
> 
>    So, »java.lang.System.out.println()« is an expression,
>    but does it have a type?

     The JLS appears to contradict itself.  The quote you give
(I found it at the start of JLS 4; perhaps it appears elsewhere,
too) claims a type for every expression, but JLS 15.3 says
(emphasis mine)

	*If* an expression denotes a variable or a value, then the
	expression has a type [...]

... excluding void expressions (per JLS 15.1).

-- 
esosman@comcast-dot-net.invalid
Eleven hundred seventy-eight days to go.

Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread


Thread

Re: Every expression has a type? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-10-30 09:05 -0400

csiph-web