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


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

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 Tue, 31 Oct 2017 12:00:43 -0400
Organization A noiseless patient Spider
Lines 31
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>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Tue, 31 Oct 2017 16:00:46 -0000 (UTC)
Injection-Info reader02.eternal-september.org; posting-host="6cbb3930c884631b073b0fc9e7411336"; logging-data="7104"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18peekp05P7DZuZ3lvxyAoP"
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0
In-Reply-To <void-20171031160227@ram.dialup.fu-berlin.de>
Content-Language en-US
Cancel-Lock sha1:PqRnfLtg72HbPxSGnlejk6Qsw2s=
Xref csiph.com comp.lang.java.programmer:37628

Show key headers only | 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