On Thursday, 23 November 2023 at 17:03:29 UTC, Julian Fondren wrote:
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) {
              ^^
```

I tried what you suggested, and with no other changes it compiled and ran correctly.
Thanks!

I just find it surprising that your suggestion worked, but the (slightly simpler) earlier version did not.

Reply via email to