DIP1044---"Enum Type Inference"---Formal Assessment

Basile B. b2.temp at gmx.com
Thu Apr 27 06:10:57 UTC 2023


On Thursday, 27 April 2023 at 00:16:10 UTC, Walter Bright wrote:
> This also works:
>
>     alias F = MySuperLongNameFlag;
>
>     auto flag = F.A | F.B | F.C | F.D;
>     set_flags(F.A | F.B | F.C | F.D);
>
> It's similar to setting a local variable to some complex 
> expression, just so you don't have to repeat that expression 
> multiple times.

It's a misconception of the problem that the DIP tried to solve. 
What the DIP tried to solve is that the compiler should know that 
you are using an enum member. Actually I even think this should 
work without any special syntax, as a "last resort", let's say. 
But as you've explained, through Mike's report, this causes 
problems for D because the identifier resolution is tied to a 
particular implementation, i.e your fast symtabs.


More information about the Digitalmars-d-announce mailing list