Improvements to switch

Walter Bright newshound2 at digitalmars.com
Mon Apr 22 16:45:35 UTC 2024


I've thought about it for a while now. Improving switch has a lot of issues with 
it, such as the unusual scoping rules, the ability to goto in and out of it, the 
ability to interleave switch/case with other looping constructs (!).

It's unsalvageable.

It's better to create a new construct, let's say "match", and design an 
unconstrained syntax for it to accommodate pattern matching in particular.

("match" is already an identifier in common use, some other name would be better.)


More information about the dip.ideas mailing list