Call for bikeshed -- break replacement in expression switch

Alex Buckley alex.buckley at oracle.com
Fri May 17 23:06:06 UTC 2019


On 5/17/2019 3:13 PM, John Rose wrote:
> On May 17, 2019, at 2:56 PM, Alex Buckley <alex.buckley at oracle.com>
> wrote:
>>
>> So, recognizing a hyphenated contextual keyword `yield-value` would
>> still require careful reasoning about context, about as much as
>> we're doing to recognize a unitary contextual keyword `yield`.
>
> Much less so than the rules either Brian or I sketched. It’s a
> statement, not an expression. And no expression statement begins with
> ID - ID right? It’s not as ambiguous as ID (.

A single-expression lambda body has the flavor of a statement form, 
though yes, it has no `;` of its own and is not parsed as 
ExpressionStatement.

   `map(    y -> yield-value +y    );`

So, I agree that parsing `yield-value (1);` as a YieldStatement in a 
SwitchLabeledBlock does not have the ambiguity of parsing `yield (1);` 
as a YieldStatement|ExpressionStatement in a SwitchLabeledBlock ... but 
the decision still has to be taken about whether "in a 
SwitchLabeledBlock" or "in <something else>" is the proper context to 
recognize something new.

Alex


More information about the amber-spec-experts mailing list