[External] : Re: Reviewing feedback on patterns in switch

Guy Steele guy.steele at oracle.com
Wed Feb 16 16:42:55 UTC 2022



> On Feb 16, 2022, at 9:57 AM, Brian Goetz <brian.goetz at oracle.com> wrote:
> . . .
> What if I want to use a partial pattern, and then customize either the throwing part or provide default values?   I can provide an else clause:
> 
>     Object o = ...
>     let String s = o
>     else throw new NotStringException();
> 
> or
> 
>     Object o = ...
>     let String s = o
>     else { s = "no string"; }

Thanks for these examples; I had forgotten exactly what was previous proposed.

> Reminder: THIS EXPLANATION WAS PROVIDED SOLELY TO CLARIFY THE "FUTURE CONSTRUCT" COMMENT IN THE && DISCUSSION.  

YES; I’M DONE NOW, THANKS!  :-)




More information about the amber-spec-experts mailing list