Implicit enum conversions are a stupid PITA

Nick Sabalausky a at a.a
Thu Mar 25 12:34:06 PDT 2010


"Adam D. Ruppe" <destructionator at gmail.com> wrote in message 
news:mailman.16.1269543119.2988.digitalmars-d at puremagic.com...
> On Thu, Mar 25, 2010 at 12:18:57PM -0500, Andrei Alexandrescu wrote:
>> I missed this. There's no need for anything close to that. We all could
>> get "upset" regarding a post or a notion, not against the person airing 
>> it.
>>
>> As far as the matter at hand of that thread is concerned, you mentioned
>> the possibility:
>>
>> alias Flags!(ubyte, "do_nothing",
>>                     "walk_dog"
>>                     "cook_breakfast"
>>                     "deliver_newspaper"
>>                     "visit_miss_kerbopple"
>>                     "wash_covers") Todo;
>>
>> I encourage you to code that up and see how it swims.
>
>
> It just occurred to me that such a thing could work on the use-side 
> exactly
> like the built in enum too, thanks to opDispatch.
>

I haven't used opDispatch, and don't remember much from the discussions of 
it, so pardon a possibly dumb question: Would that prevent you from getting 
a (meaningful) compile-time error if you mis-typed one of the flags?





More information about the Digitalmars-d mailing list