Block expressions with `yield` for its value?
Brian Goetz
brian.goetz at oracle.com
Thu Aug 25 21:04:02 UTC 2022
This came up when we did switch expressions. Brief answer: no. Blocks
already have a pretty strong association in Java -- something that holds
statements. Java developers would likely find it a jarring gear-change
to start seeing these as expressions. Additionally, it creates new
points of confusion, such as interaction of yield with break/continue,
or nested block expressions (next request would be: can I yield to an
uplevel expression?) This is as far as we're comfortable going right now.
On 8/24/2022 3:26 PM, Tesla Zhang wrote:
> Hi all,
>
>
> Since switch expressions have block bodies with `yield` specifying its
> value, is it a good idea to generalize this to all blocks, and allow
> blocks as expressions?
>
> ------------------------------------------------------------------------
> Regards,
> Tesla
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20220825/395f1ed3/attachment.htm>
More information about the amber-dev
mailing list