Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37608 > unrolled thread
| Started by | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| First post | 2017-10-30 09:05 -0400 |
| Last post | 2017-10-30 09:05 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.java.programmer
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Every expression has a type? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-10-30 09:05 -0400
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Date | 2017-10-30 09:05 -0400 |
| Subject | Re: Every expression has a type? |
| Message-ID | <ot783d$fq8$1@dont-email.me> |
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 top | Article view | comp.lang.java.programmer
csiph-web