> From: "Brian Goetz"
> To: "Remi Forax" , "amber-spec-experts"
>
> Sent: Lundi 27 Septembre 2021 17:07:06
> Subject: Re: It should be possible to type a switch expression with void
> This is part of a larger problem, and I don't think point fixes are really the
> answer here. For this reason
- Original Message -
> From: "Tagir Valeev"
> To: "Remi Forax"
> Cc: "amber-spec-experts"
> Sent: Lundi 27 Septembre 2021 06:38:14
> Subject: Re: It should be possible to type a switch expression with void
> If you expect this to be changed, the same would be expected e.g. from ?:
>
This is part of a larger problem, and I don't think point fixes are
really the answer here. For this reason (and others), any sort of "type
more things as void" is on hold for now. Here's a sketch of the
motivation, which comes from Valhalla.
A big part of Valhalla is unifying primitives
If you expect this to be changed, the same would be expected e.g. from
?: expression. This also would create some kind of confusion: the
switch expression cannot be inside the expression statement, but the
expression statement is mostly associated with void-type expression.
Btw, there's another
There is a bad interaction between a lambda and a switch expression,
a lambda allows its expression to be typed void but a switch expression can not
be typed void,
so the following code does not compile
sealed interface I permits A, B {}
record A() {}
record B() {}
public Optional