On Tuesday, 16 December 2025 at 20:56:06 UTC, Richard (Rikki) Andrew Cattermole wrote:
On 17/12/2025 9:48 AM, DLearner wrote:
I have a rather complicated string mixin defined and invoked from within the same source file.
Which seems to work.

But when I move the mixin definition to a separate module, and import that module into the original source file, the compilation collapses complaining that array concatenation requires the GC, which is not available with -betterC.

[...]

string genStuff(string val) {
        return val ~ ";";
}

void myFunc() {
        mixin(genStuff("this"));
}
```

This won't work without a way to mark `genStuff` as CTFE only. Which doesn't exist currently.

Compiler has to know that a given execution context is CTFE only otherwise disallowed.

1. Any proposals to mark a function as CTFE only?
2. Why (and I've now got this down to a cut-and-paste) is there no problem if the mixin definition is in the main function, but problem appears if the definition is moved to a separate module (which is imported into the main function)?

DL

  • Do string mixins... DLearner via Digitalmars-d-learn
    • Re: Do stri... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: Do ... DLearner via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... DLearner via Digitalmars-d-learn
            • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... DLearner via Digitalmars-d-learn
        • Re:... Adam D. Ruppe via Digitalmars-d-learn
          • ... DLearner via Digitalmars-d-learn
    • Re: Do stri... Kapendev via Digitalmars-d-learn

Reply via email to