break seen as a C archaism

Remi Forax forax at univ-mlv.fr
Thu Mar 15 19:40:01 UTC 2018



----- Mail original -----
> De: "Guy Steele" <guy.steele at oracle.com>
> À: "mark" <mark at io7m.com>
> Cc: "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Envoyé: Jeudi 15 Mars 2018 20:18:34
> Objet: Re: break seen as a C archaism

>> On Mar 15, 2018, at 3:06 PM, Mark Raynsford <mark at io7m.com> wrote:
>> 
>> On 2018-03-15T14:50:45 -0400
>> Brian Goetz <brian.goetz at oracle.com> wrote:
>>> 
>>>> 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....
>> 
>> Silly idea, but... *puts on fireproof suit*:
>> 
>>  "finally x;"
> 
> Interestingly, the keywords `try` and `catch` and `finally` currently must each
> be followed by a block, so there is indeed syntactic space to use each one with
> a following expression instead.
> 
> Which only suggests that . . . *puts on fireproof suit and then climbs into a
> concrete bunker and slams the door*:
> 
>   “try x;”
> 
> would be shorter and no sillier.
> 
> —Guy

It seams too close to the try-with-resources.

compare
  try (resource) -> { };  // a try that break/return a lambda
with
  try (resource) { }  // a try-with-resources

Rémi


More information about the amber-spec-observers mailing list