Andrei:
> http://stackoverflow.com/questions/6315882/pattern-matching-in-d
Pattern matching is very useful if you have a functional mindset. In Haskell
functions are mostly based on it. But to implement pattern matching you
probably need some kind of structural typing (this means two data types are
seen as the same type if they contain the same fields in the same order,
regardless of the names. Time ago I have vaguely asked for structural typing
for D tuples), and some significant amount of added language complexity (Scala
pattern matching has required several small things). So I don't think it's good
to add pattern matching to D2.
A possible *low-priority* idea is instead to allow arrays too and structs as
items to switch on, to allow switching on bigInts too:
http://d.puremagic.com/issues/show_bug.cgi?id=596
(I have said low priority because I think there are more important things to
add.)
Bye,
bearophile