Bug 3999 and 4261

Steven Schveighoffer schveiguy at yahoo.com
Thu Sep 2 06:07:06 PDT 2010


On Wed, 01 Sep 2010 17:12:04 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 9/1/10 15:35 CDT, bearophile wrote:
>> so:
>>> Another taste discussion?
>>
>> Nope.
>>
>> -----------------
>>
>> Steven Schveighoffer:
>>> And I think if you have an idea to try and "fix" it, you might as well  
>>> know now, it will never happen.<
>>
>> There I was explaining something better to Daniel Gibson. The purpose  
>> of the enhancement request 3999 has nothing to do with a request for a  
>> different keyword.
>>
>> -----------------
>>
>> I think now I have presented my point as well as I can, and people have  
>> given comments and opinions. I'd like to Walter or/and Andrei to  
>> express their opinion about the bug 3999 :-)
>
> I think it's a good enhancement. C++'s good old enum has been  
> instrumental in finding a few bugs and clarifying a few interfaces in a  
> project at work. Based on that experience I'd say that there's a chance  
> more restrictive is better. We need to find a principled way to define  
> semantics though - if we disable comparison it really means we're  
> disabling implicit conversion.

Does this mean no more defining bits as enums?

enum myBits
{
    flag1 = 1;
    flag2 = 2;
    flag3 = 4;
}

void fn(int flags);

fn(myBits.flag1 | myBits.flag2);

That was the one case where I really like the implicit conversion.

-Steve


More information about the Digitalmars-d mailing list