Improvements to switch
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Mon Apr 22 17:33:42 UTC 2024
On 23/04/2024 4:45 AM, Walter Bright wrote:
> 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.)
I was really looking forward to your recent DConf Online talk about
matching.
It is why I have avoided this idea up until now, I wanted to see what
you have come up with.
Same thing for sum types.
If you have any design work on this subject, I think other people not
just myself would be interested in having a read.
More information about the dip.ideas
mailing list