An idea (Re: Implicit enum conversions are a stupid PITA)
bearophile
bearophileHUGS at lycos.com
Thu Mar 25 05:01:25 PDT 2010
Walter Bright:
> Such rules are interesting, but I worry that they are both too clever and too
> obtuse. Having a lot of such rules may make using D very frustrating because
> you'll never know when you'll get hit by one of them.
>
> I'd rather have a simpler, more orthogonal, and easier to remember rules that
> may have a downside here and there rather than a complex web of seemingly
> arbitrary ones.
I agree a lot, and I agree Don was wrong here.
In my posts I have already shown a better solution, that's similar to the C# one:
enum Foo {...} // normal enum, no implicit conversions, no operators
@flags enum Foo {...} // no implicit conversions, boolean operator plus "in".
Bye,
bearophile
More information about the Digitalmars-d
mailing list