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

Timon Gehr timon.gehr at gmx.ch
Sat Nov 19 12:22:53 UTC 2022


On 11/19/22 05:22, Walter Bright wrote:
> Consider this:
> 
>      enum A { a; }
>      enum B { a; }
> 
>      void f(A);
>      void f(B);
> 
>      ...
>      f($a + $a); // mentioned in the DIP as allowed
>      ...
> 
> Since the DIP allows expressions containing such enum inferences, it 
> looks like we are faced with the possibility of having to re-run the 
> semantic pass for enum arguments for every enum overload.

Only if the new feature is actually used, and yes, this is the same as 
for function literals. I guess the implementation can be optimized 
further for enum arguments, but I doubt it would make a meaningful 
difference.



More information about the Digitalmars-d mailing list