How to complex switch?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu May 12 07:45:27 PDT 2011


On 5/12/11 6:13 AM, Matthew Ong wrote:
> Hi All,
>
> Anyway to include this cool feature of switch with D in the near future?
>
> switch(str){
>                     // regexp
> case "abc", "def", "as+b?": s1(); break;
>
> case "za+", "wd?", "aaa": s2(); break;
>
> default: s3();
> }

This is a nice feature, but probably it won't be added to D.

Somebody new to a programming language often has a collection of nice 
artifacts from the other languages she might know. At first, they seem 
very worthwhile and of obvious benefit. Once the person continues using 
the language for a while, a sense develops for what is in the spirit of 
that language and what is less so. The opposition to this feature has 
been more or less rationalization of that intuition.


Thanks for joining,

Andrei


More information about the Digitalmars-d mailing list