A safer switch?

Kagamin spam at here.lot
Tue Oct 13 03:19:26 PDT 2009


Andrei Alexandrescu Wrote:

> grauzone wrote:
> > If you still don't like it, you can do some ugly mixin() and CTFE stuff. 
> > Nobody will mind because that's modern D style.
> 
> import std.getopt;
> 
> void main(string[] args) {
>      getopt(args,
>          "s", { writefln("handle argument -s"); },
>          "-m", { writefln("handle argument -m"); });
>      ...
> }

What's even better, modern D style allows you to work around some misdesigned/legacy language features.



More information about the Digitalmars-d mailing list