DIP19: Remove comma operator from D and provision better syntactic support for tuples
bearophile
bearophileHUGS at lycos.com
Sun Sep 23 16:55:38 PDT 2012
Timon Gehr:
> 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.
Introducing a good pattern matching syntax in D requires the
introduction of a good amount of complexity. This idea was
discussed few times in past.
D switches also work on strings, wstrings, dstrings, so the idea
of extending them to work on small array is not too much
different.
I think that switching on structs, and tuples with
auto-assignment of variables for tuple fields, is enough to
extend the usefulness of D switches significantly, while it
introduces no new keywords, and not a lot of complexity for both
the compiler and the programmer that has to learn D language.
Bye,
bearophile
More information about the Digitalmars-d
mailing list