Implicit enum conversions are a stupid PITA
bearophile
bearophileHUGS at lycos.com
Sun Mar 28 16:05:19 PDT 2010
Andrei Alexandrescu:
> For what it's worth, Walter and I were talking three years ago about a
> "new alias" feature:
>
> template Flags(new alias Names...) { ... }
>
> "new alias" means that you may pass to Flags symbols that haven't been
> defined. With that feature in place, Flags could be used like this:
>
> alias Flags!(do_nothing,
> walk_dog,
> cook_breakfast,
> deliver_newspaper,
> visit_miss_kerbopple,
> wash_covers)
> Todo;
>
> No muss, no fuss, no need to stringize anything.
Maybe it's better to go all the way and just add symbols to the language, as in Ruby, Lisps, etc. I don't know. The #walk_dog syntax is not available to represent a symbol "walk_dog", I presume...
Bye,
bearophile
More information about the Digitalmars-d
mailing list