> On Mar 30, 2018, at 10:54 AM, Remi Forax <fo...@univ-mlv.fr> wrote:
> 
> I do not see (B) as sacrifying the consistency because the premise is that an 
> expression switch should be consistent with ?:
> 
> But an expression switch can also be modeled as a classical switch that 
> returns it's value to a local variable.
> 
>  int a = switch(foo) {
>    case 'a' -> 2;
>    case 'b' -> 3;
>  }
> can be see as
>  int a = $switch(foo);
> with
>  int $switch(char foo) {
>    case 'a': return 2;
>    case 'b': return 3;
>  }

I mean, sure, this is another way to assert "switches in assignment contexts 
should always be poly expressions".

But it's just as easy to assert "conditional expressions in assignment contexts 
should always be poly expressions".

int a = test ? 2 : 3;
can be seen as
int a = $conditional(test);
with
int $conditional(boolean test) {
    if (test) return 2;
    else return 3;
}

Those are probably good principles. But if we embrace them, we're doing (C).

—Dan

Reply via email to