Bug 3999 [Was: Re: Implicit enum conversions are a stupid PITA]

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Mar 25 09:31:19 PDT 2010


On 03/25/2010 11:17 AM, bearophile wrote:
> Andrei Alexandrescu:
>> The problem is it asks you to insert casts all too often. I think the
>> value range propagation is a principled and correct solution to that
>> problem.
>
> In bugzilla I have asked to disable the implicit conversion enum =>  base type in an equality test, see:
> http://d.puremagic.com/issues/show_bug.cgi?id=3999
>
> In bugzilla I have never asked to disable implicit signed =>  unsigned casts, I am able to see they are two quite different situations.
>
> I think the implicit conversions from enum =>  base types are uncommon enough, so they can't introduce too many casts.
>
> If Walter doesn't agree with me (and few other people here) then there's no point in keeping bug 3999 open, it can be closed. Because it's better to fix/change similar things now, when the D2 language is not diffused yet. Later such changes are harder to do.
>
> In bugzilla there are few other things that deserve a similar look. Those changes can't be done all at the same time, but the decision can be taken in a short enough time, and it's better to think about them now.
>
> Bye and thank you for your attention,
> bearophile

I think defining a integral() function that gives the value of the enum 
as an appropriately-typed integral number wouldn't harm.

Andrei



More information about the Digitalmars-d mailing list