div0:

>Spec explicity says enums are convertible to their base type:<

Right, but I am not sure it's a good design decision. I think requiring a cast 
can be better.


>but changing the current behaviour of enum could be pain.<

In the meantime I have written an "enhancement" report (3999), but now I am not 
sure that I have done the right thing.


>Besides, use of enums should be discouraged in general.<

D enums are a significant improvement over long list of normal integer 
constant, as I see sometimes in C code. They are safer and nicer.


>It sucks maintaining code where you've thousands of switch statements all over 
>the place; there's nearly always a better way.<

Unfortunately in D there are no computed gotos yet (even if gcc supports them 
and LLVM is starting to be able to manage them), and today D back-ends aren't 
able to inline virtual functions, so in some situations (final, in D2) they are 
the best solution I see in D. Sometimes I have to switch over many gigabytes of 
data.

Thank you for your answers,
bye,
bearophile

Reply via email to