A plea for pattern matching

KlausO kobi at goppertsweiler.de
Fri Dec 26 15:53:06 PST 2008


bearophile wrote:
> KlausO, I like limited forms of pattern matching, I have asked for them in D in the past; they also fit with the growing functional nature of D2.
> But I've seen the pattern matching you can see for example in Scala adds lot of complexity to the compiler (and some to the language too), and D2 is already a quite complex language. So I am not sure it's a good thing to add it to D2.
>
> Bye,
> bearophile
>   

Maybe you are right, but the part that deals with pattern matching
in the Scala compiler is quite small compared to the rest of the compiler.

Funny: Advanced Scala concepts like extractor objects with it's
fixed named apply/unapply methods looks a bit like D's operator overloading.
And case classes seems to be syntactic sugar which makes the programmers
live easier by implicitly declaring an extractor object and some
overloaded functions (equals, hashCode, toString) to identify the class 
type.
IMHO most of this is already contained as meta data in D's type descriptors.
Greets,


KlausO



More information about the Digitalmars-d mailing list