Re: Yield as contextual keyword (was: Call for bikeshed -- break replacement in expression switch)

2019-05-23 Thread Tagir Valeev
Also an interesting case: var yield = 5; var res = switch(yield) { default -> yield + yield; } // are we returning result of binary plus (10) or yielding result of unary plus (5)? Seems the first one, yet confusing. Tagir. On Fri, May 24, 2019 at 4:30 AM Dan Smith wrote: > > > On May 22, 2019,

Re: Yield as contextual keyword

2019-05-23 Thread Alex Buckley
On 5/23/2019 2:29 PM, Dan Smith wrote: 2) Type names: 'yield' might be used as the name of a class, type of a method parameter, type of a field, array component type, type of a 'final' local variable etc. Or we can prohibit it entirely as a type name. We went through this when designing 'var', a

Re: Yield as contextual keyword (was: Call for bikeshed -- break replacement in expression switch)

2019-05-23 Thread John Rose
On May 23, 2019, at 2:29 PM, Dan Smith wrote: > > Are people generally good with my preferred restrictions, or do you think > it's better to be more permissive? In this case I prefer the restrictions because, again, it's a simpler user experience. The loss of the method name "yield" for an *un

Re: Yield as contextual keyword (was: Call for bikeshed -- break replacement in expression switch)

2019-05-23 Thread Dan Smith
> On May 22, 2019, at 9:45 AM, Brian Goetz wrote: > > The “compromise” strategy is like the smart strategy, except that it trades > fixed lookahead for missing a few more method invocation cases. Here, we > look at the tokens that follow the identifier yield, and use those to > determine whet