Discussion Thread: DIP 1044--Enum Type Inference--Community Review Round 1

XavierAP n3minis-git at yahoo.es
Thu Nov 24 14:01:27 UTC 2022


On Wednesday, 23 November 2022 at 23:50:55 UTC, Walter Bright 
wrote:
> On 11/23/2022 8:13 AM, XavierAP wrote:
>> But interoperating with C isn't the problem here, because C 
>> enums don't map to D enums but to integers?
>
> ImportC maps C enums to D enums.

Ah nice. I didn't know, I'm currently playing with (a version 
of?) Derelict which binds in a different, more C-like and pointy 
way.

I'm just worried that the defect of C enums being 
unqualified/weakly typed caused the workaround/defect of 
repeating the type name in every value, which when imported into 
a better enum language like D causes annoyance, which causes some 
people to wish for enums not requiring qualification to avoid the 
repetition. Whereas the cause of the repetition is the specific 
enum declarations (which can be aliased), not the D language. 
When an enum is properly named without repetition I think it's 
good that you have to qualify it -- outside possibly the special 
case of initialization. So did the designers of many modern 
languages including the C++ committee.

So I still personally think this proposal is a bad idea. 😇


More information about the Digitalmars-d mailing list