On Monday, 27 December 2021 at 22:52:58 UTC, data pulverizer wrote:
I think the only thing to do for now is probably for me to construct a template that creates a proper string for this type.

It would look something like this:

```
enum safe_stringof(T) = T.stringof;
template safe_stringof(T: MyType!U, alias U)
{
  enum string safe_stringof = "MyType!(" ~ U.stringof ~ ")";
}
```

So this

```
alias DOUBLE = MyEnum.DOUBLE;
alias STRING = MyEnum.STRING;
alias INTEGER = MyEnum.INTEGER;

void main()
{
  alias T = MyType!(INTEGER);
  alias U = MyType!(STRING);
  enum code = "writeln(\"instance: \", adder(" ~
safe_stringof!(T) ~ "(), " ~ safe_stringof!(U) ~ "()" ~ "));";
  pragma(msg, code);
}

```

Which works. Now back to my very late dinner.

Reply via email to