On 09/24/2012 01:36 AM, bearophile wrote:
Timon Gehr:
cases already introduce their own scopes in D,
Thank you, I didn't remember this.
but switch cannot be extended well to serve such use cases.
Please explain, as I am not able to see the problems.
Switch is syntax sugar for jump tables. An adequate pattern matching
construct would not require explicit control flow statements, and it
would be an expression of arbitrary type.
I have discussed that topic a little here:
http://d.puremagic.com/issues/show_bug.cgi?id=596
Bye,
bearophile