An idea (Re: Implicit enum conversions are a stupid PITA)
Nick Sabalausky
a at a.a
Thu Mar 25 13:32:19 PDT 2010
"Regan Heath" <regan at netmail.co.nz> wrote in message
news:hogaop$2kp2$1 at digitalmars.com...
> Nick Sabalausky wrote:
>> Here's the low-hanging fruit I see:
>>
>> Step 1: Remove implicit enum->base-type conversions
>> Step 2: Allow '|' (and maybe '&'?) on enums, and consider the result of
>> the operation be the base type.
>
> I would prefer the result of Step 2 to be the enum type, not the base
> type(*)
>
Agreed, but to do that correctly, the compiler would have to be able to
distinguish between flag/bitfield-type enums and other enums, because many
enums are *not* intended to be combinable and trying to do so should be an
error. That's why I suggested the above as a low-hanging-fruit compromise.
But yea, if Walter were fine with taking it further and having that proper
separation of flag/bitfield enums and non-flag/non-bitfield enums, then all
the better.
More information about the Digitalmars-d
mailing list