mixin under -betterC

Julian Fondren julian.fondren at gmail.com
Thu Nov 23 17:03:29 UTC 2023


On Thursday, 23 November 2023 at 16:33:52 UTC, DLearner wrote:
> Why is this so, bearing in mind the concatenations are executed 
> at
> compile, not run, time?

If you compile without -betterC, it'll work, but if you examine 
the result you'll find that the mxnTest function is still 
compiled into the result. D makes it so convenient to use 
functions at compile-time that there's no clear distinction for 
functions that should only exist at compile-time.

Make mxnTest a template:

```d
string mxnTest()(string strVar1, string strVar2) {
               ^^
```


More information about the Digitalmars-d-learn mailing list