break seen as a C archaism
asviraspossible at gmail.com
Mon Mar 12 19:58:24 UTC 2018
Got it. I agree that it's better to extend switch as it is than to
introduce new duplicating mechanism. My aim was to explicitly state what
seems most irregular in current design. My gut feeling is that may be there
is a some other way to extend switch that can be somewhat better...
пн, 12 мар. 2018 г., 22:38 Brian Goetz <brian.goetz at oracle.com>:
> > Most problematic for me is that everywhere in Java block syntax (curly
> > braces) is used to switch (no pun intendent) between single expression
> > / statement and multiple statement variant. But for switch expressions
> > colon and arrow is used instead... This seems verry irritating seens
> > whole language managed to use block syntax everywhere else before...
> But, the whole point is, we *didn't* use block syntax everywhere before
> -- specifically not in switch. The treatment of blocks in switch has
> always been an irregularity. And the proposal about switch is in
> keeping with how switch has always worked.
> Is this the only way we could play it? Surely not. We could try to
> "fix" switch -- as many have suggested we do. And doing so will create
> obvious seams. We could make a new construct, "match", that is like
> switch, but not. Then we'll have two similar, but different, ways to do
> the same thing. So my preference has been, to the extent was can extend
> switch in a manner consistent with its heritage, let's do that.
> Would we do this if were designing a new language from scratch? Of
> course not. But that's not what we're doing here.
More information about the amber-spec-observers