Switch expressions spec
Manoj Palat
manoj.palat at in.ibm.com
Wed Mar 6 09:51:49 UTC 2019
Hi Alex, Gavin,
A few comments/clarifications:
1: In section, 14.15 The break Statement
A break statement transfers control out of an enclosing statement, or
causes an enclosing switchexpression to produce a specified value.
BreakStatement:
break [~~ Identifier ~~] ;
break Expression ;
break ;
the identifier is dropped – That looks like a typographical issue (since it
was mentioned that there was not functional difference) – Identifier is
mentioned in the statements following the above para as well. Similar issue
is displayed in "continue" section also.
2. A related query, though a bit late, but better late than never:) - : In
the Eclipse Compiler implementation we assume expression encompasses
identifier (in the syntax context), and then deduce whether this is a label
or an expression later in the resolution context. From the grammar above,
it does not look like we can distinguish whether an identifier is a label
or an expression in the first place? An explicit statement in the spec
about how to distinguish would be helpful.
3. In section, 5.6 – “A unary numeric promotion applies numeric promotion
to an operand expression and a notional non-constant expression of type int
.”
It will be nice to explain in the spec a little more as to what is meant by
“a notional non-constant expression” ?
Regards,
Manoj
Eclipse Java Dev. Tools
Alex Buckley wrote:
For clarity, we have renamed the January 2019 version from:
http://cr.openjdk.java.net/~gbierman/switch-expressions-old.html
to:
http://cr.openjdk.java.net/~gbierman/switch-expressions-2019-01.html
The CSR for switch expressions (JDK-8207241) has the spec as an
attachment, but also links to an online version for reader convenience.
Originally it linked to `switch-expressions.html`, but that is a living
document and hence unsuitable for a CSR, so now it links to
`switch-expressions-2019-01.html`.
Alex
On 2/27/2019 4:43 AM, Gavin Bierman wrote:
> I have uploaded a revised switch expressions spec at:
>
> http://cr.openjdk.java.net/~gbierman/switch-expressions.html
>
> This is functionally equivalent to the spec uploaded last month. The
change is in how we specify the type checking of switch expressions. We
have make simplifications to make it more consistent with the specification
of conditional expressions. The behaviour of type checking is unchanged.
>
> Thanks,
> Gavin
>
> PS: I have left the January version at
http://cr.openjdk.java.net/~gbierman/switch-expressions-old.html for
reference.
>
>> On 17 Jan 2019, at 10:14, Gavin Bierman <gavin.bierman at oracle.com>
wrote:
>>
>> Thank you Alex and Tagir. I have uploaded a new version of the spec at:
>>
>> http://cr.openjdk.java.net/~gbierman/switch-expressions.html
>>
>> This contains all the changes you suggested below. In addition, there is
a small bug fix in 5.6.3 concerning widening (
https://bugs.openjdk.java.net/browse/JDK-8213180). I have also taken the
opportunity to reorder chapter 15 slightly, so switch expressions are now
section 15.28 and constant expressions are now section 15.29 (the last
section in the chapter).
>>
>> Comments welcome!
>> Gavin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190306/6c9209b3/attachment.html>
More information about the amber-spec-experts
mailing list