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

Walter Bright newshound2 at digitalmars.com
Mon Nov 21 17:51:44 UTC 2022


On 11/21/2022 8:29 AM, IchorDev wrote:
> On Friday, 18 November 2022 at 21:29:15 UTC, Walter Bright wrote:
>> The following is not addressed:
>>
>>     enum E { e };
>>     int e;
>>     auto x = e;  // which e?
>>
>>     void bahb(int);
>>     void bahb(E);
>>     bahb(e);  // which bahb?
> 
> Your example is written without using ETI.
> It should look like this if you want to use the enum member with ETI:
> ```d
> enum E { e }
> int e;
> auto x = $e; //E.e
> 
> void bahb(int);
> void bahb(E x);
> bahb($e); //E.e
> ```
> Otherwise the local variable will be used, because that's how D works.

Ok.


More information about the Digitalmars-d mailing list