Ambiguity issue with expanding and evaluating single template type parameter enums

Adam Ruppe destructionator at gmail.com
Mon Dec 27 21:31:03 UTC 2021


On Monday, 27 December 2021 at 21:05:51 UTC, data pulverizer 
wrote:
> adder(MyType!MyEnum.INTEGER(), MyType!MyEnum.STRING());

The rule for !(args) is of you leave the parenthesis off, it only 
uses the next single token as the argument. So it will never 
include a dot; it is like you wrote `MyType!(MyEnum).INTEGER`.

You might just always use the () in your generated code.... when 
you create that mixin string can't just just change the generator 
to put the () around it? Or is the stringof generating this? 
(Another reason why stringof is terrible and should never be used 
ever for anything.)

> `MyType!MyEnum.STRING` is generated with `T.stringof `. I get 
> the error:

if you can paste teh code where you generate this I can prolly 
show you a much easier way to do it. stringof sucks really hard.


More information about the Digitalmars-d-learn mailing list