break seen as a C archaism
forax at univ-mlv.fr
Thu Mar 15 19:41:35 UTC 2018
----- Mail original -----
> De: "Guy Steele" <guy.steele at oracle.com>
> À: "Brian Goetz" <brian.goetz at oracle.com>
> Cc: "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Envoyé: Jeudi 15 Mars 2018 20:12:56
> Objet: Re: break seen as a C archaism
>> On Mar 15, 2018, at 2:50 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
>>>> We had rejected this earlier for fairly obvious reasons, but let me
>>>> ask to get a subjective response: would using "return x" be better?
>>> If you are reconsidering options, reconsider "yield", meaning
>>> "break current context with this value".
>> Still feeling a little burned by first time we floated this, but willing to try
>> another run up the flagpole....
>> In Lambda, I used the early "State of the Lambda" drafts as a means to
>> test-drive various syntax options. SotL 2/e floated "yield" as the
>> get-out-of-lambda card, and I was unprepared for the degree of "you big fat
>> stupid idiot, don't you know what yield means" response I got. So we beat a
>> hasty retreat from that experiment, temporarily settled on return, and then
>> failed to circle back. I still regret the choice of return for lambda.
>> The primary objection to yield was from the async/await crowd that would want us
>> to save it for that, but I don't see them as mutually exclusive (nor do I think
>> async/await is all that likely, especially with the great work happening over
>> in Loom).
>> The loss of using something other than "break" is that now expression and
>> statement switches become more obviously different beasts, which might be OK.
> I have to agree that “yield” has too much of a history in the topics of
> multithreading and coroutining, giving it all the wrong connotations for our
> purpose here.
and if Loom at some point requires a syntax instead of being a pure API, it will be unfortunate.
More information about the amber-spec-experts