On 17/12/2025 12:25 PM, DLearner wrote:
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?

No, this is something that should've been done a while back.

The main concern is that you can get a linker error if you don't emit a function that was called.
  • 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