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


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

Re: Every expression has a type?

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Every expression has a type?
Date 2017-10-31 12:00 -0400
Organization A noiseless patient Spider
Message-ID <ota6ne$6u0$1@dont-email.me> (permalink)
References <Every-20171030130857@ram.dialup.fu-berlin.de> <ot97eq$47m$1@dont-email.me> <void-20171031160227@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 10/31/2017 11:03 AM, Stefan Ram wrote:
> Wayne <wayne@nospam.invalid> writes:
>> See 15.1, where all that is spelled out (Java 9 version):
> ...
>> (§8.4). Such an expression can be used only as an expression statement (§14.8) or as
>> the single expression of a lambda body (§15.27.2), because every other context in
>> which an expression can appear requires the expression to denote something. ..."
> 
>    My compiler is fine with this one:
> 
> public final class Main
> {
> 
>    private static void nothing() {}
> 
>    public static void main( final java.lang.String[] args )
>    { for( nothing(); true; nothing() )break; }}

     JLS 14.14.1 tells us that the first and third pieces of
"BasicForStatemet" are "ForInit" and "ForUpdate", respectively.
Both of these are "StatementExpressionList"s, which are comma-
separated lists of "StatementExpression"s.  A "StatementExpression"
is that part of an "ExpressionStatement" preceding the semicolon
(14.8), so all is well.

     (By the way, I just found yet another infinity of angels holding
a cotillion on that zero-sized pinhead.)

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

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


Thread

Re: Every expression has a type? Wayne <wayne@nospam.invalid> - 2017-10-31 03:07 -0400
  Re: Every expression has a type? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-10-31 12:00 -0400
  Re: Every expression has a type? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-10-31 13:06 -0400

csiph-web