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

Walter Bright newshound2 at digitalmars.com
Mon Nov 21 17:50:24 UTC 2022


On 11/20/2022 8:52 AM, IchorDev wrote:
> Could you please provide a concrete example of this so I can better understand 
> what you mean? (ideally one that I can run if I substitute out the ETI)



enum A { a }
enum B { a }

void foo(A);
void foo(B);

auto bar(T)(T x) { return ....; } // is bar returning an A or a B?

foo(bar!($a));

The template bar will have to be instantiated twice in order to determine the 
type of the argument being passed to foo(). If there are multiple arguments with 
$field somewhere in them, this is a combinatorial problem.


More information about the Digitalmars-d mailing list