Matthew Ong:

> Anyway to include this cool feature of switch with D in the near future?

I think there are no plans in adding a switch as powerful as you ask.

The idea of adding pattern matching to D as in functional languages (as seen in 
Haskell, OCaML or even Scala) was discussed, it's a nice feature if you also 
have algebraic data types, but it will not be added to D2 and probably not even 
to D3, despite D wants to be a bit functional too.

On the other hand there is an enhancement request about making switch a little 
more powerful:
http://d.puremagic.com/issues/show_bug.cgi?id=596

D switch already supports switching on strings, so switching on arrays too 
(like an array of ints) is probably not too much hard to add. And switching on 
structs too will be quite useful (example: BigInts too become usable). Such 
switch enhancements probably aren't for D2.

Bye,
bearophile

Reply via email to