Ambiguity issue with expanding and evaluating single template type parameter enums
data pulverizer
data.pulverizer at gmail.com
Tue Dec 28 00:42:18 UTC 2021
On Tuesday, 28 December 2021 at 00:32:03 UTC, Paul Backus wrote:
> The result of `.stringof` is completely implementation-defined,
> may change arbitrarily between compiler releases, and is not
> even guaranteed to be valid D code in the first place.
Wow, I didn't know this.
> In this case, the simplest solution is to have your code
> generator accept a string as its input, rather than a type. For
> example:
>
> ```d
> enum instantiate(string type, string expr) = type ~ "(" ~ expr
> ~ ")";
> pragma(msg, instantiate!("RVector!(SEXPTYPE.REALSXP)", "x"));
> ```
Well the code needs to be responsive from parameter types `T`
generated from other code. I'm allowing the user to create
functions select those they wish to access in R by UDA decorators
in the D script which I then filter for and wrap the necessary
functions generating any type conversion code I need at compile
time to create functions callable in R.
More information about the Digitalmars-d-learn
mailing list