kevinb at google.com
Fri Feb 1 19:52:16 UTC 2019
On Fri, Feb 1, 2019 at 2:41 PM Brian Goetz <brian.goetz at oracle.com> wrote:
> > It seems we’re all in favor of break-with over unadorned “break”?
> Just for the record, there are possibly-complementary options in this
> direction. This is not a proposal, as much as putting them on the record.
> - Allow `break-with` as a synonym for `return` in lambdas. Using
> `return` was an uncomfortable choice (but this may well be locking the barn
> after the horse escapes.)
I don't think I agree that there is any problem with `return`. Lambdas
ended up extremely similar to "concise anonymous classes (that downplay
identity)". Users are generally well-served to think of them that way. It
seems to me that any alternative to `return` could only confuse matters.
> - `break-to` as a synonym for labeled break.
Hmm. Presumably `break` would never be "deprecated", and permanent synonyms
like this are undesirable. But this does read nicely and I don't hate it.
> - `break-from for | while | do` as a synonym for “break from the
> innermost control construct of this kind” (as an alternative to creating a
I don't hate this either. If we want the feature then this would be a good
name for it. And you may remember our data does actually show that it's not
too rare for the loop types to be different in this way. But this feature
would create a bit of perverse incentive to take two nested loop headers
that might have very parallel structure and arbitrarily write them
differently (for vs. while) just to avoid the ugly label.
> Overall I don’t find any of these terribly compelling, but perhaps this
> may jog some actually-good ideas.
Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at google.com
More information about the amber-spec-observers