Switch syntax; pedagogical nightmare?

Ryan Leach rleach at rleach.id.au
Thu Aug 3 11:14:22 UTC 2017

Hey all,

I just watched the Java One talk by Brien, and can't help but feel that
overloading the 'switch' keyword for pattern matching is a hell of a
mistake. I realize the appeal in that it doesn't introduce a new keyword
due to backwards source compatibility, but feel like it's a pedagogical

Having the break;s left off is clearly desirable for pattern matching that
involves destructing, but you are going to be leading so many newbies to
using switch statements (as opposed to expressions) without break,
expecting it to behave similar to the new expression usage of switch.

If pattern matching is introduced, I see it having a huge effect on newly
written high level Java code, so the 'legacy' switch usage will seem
archaic/rare in comparison with it's breaks.

For reference, I'm experienced in helping new Java developers who struggle
with lambda's due to the unexplicit types, and inferred return types, not
understanding the error messages thrown their way, among other common
gaffs, in a few Minecraft modding communities.

Ryan Leach

More information about the amber-dev mailing list