break seen as a C archaism
guy.steele at oracle.com
Thu Mar 15 19:12:56 UTC 2018
> 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.
More information about the amber-spec-observers