On Sun, Dec 10, 2017 at 2:40 PM, Brian Goetz <[email protected]> wrote:

So, speaking semantically only:
>  - We should not allow fall through in expression switch; I don’t think it
> makes any sense.
>  - I’m pretty convinced that nonlocal returns out of expression switch
> (other than throwing) is similarly a wrong fit.  (We allow this in neither
> conditional expressions nor lambdas.)
>  - Switch expressions should definitely be able to reference locals, but
> we’re open minded to some restrictions (such as no mutation).
>  - We could justify allowing switch expressions to mutate locals, since
> other expressions can too, but we could similarly justify restricting
> mutation
>  - More strongly, we could justify restricting even referencing
> non-eff-final locals, though this is starting to get onto thin ice, because
> the only argument we have for this is “for (superficial) consistency with
> lambdas”, which is pretty weak.
>

I believe I agree on all points. I think replacing : with -> is a very nice
fit even if it's slightly more permissive than a lambda. Being just as
restrictive does not seem justified.


-- 
Kevin Bourrillion | Java Librarian | Google, Inc. | [email protected]

Reply via email to