On Tuesday, 28 October 2025 at 21:14:42 UTC, Bastiaan Veelo wrote:

This seems to be a bug. It does work with runtime arguments, but only if the predicate is given as a string:
```d
    s = s.substitute!"a.toLower==b.toLower"("&", "&",
                                            "&lt;", "<",
                                            "&gt;", ">",
                                            "&quot;", `"`,
"&apos;", "'").to!string;
```

-- Bastiaan.

Yes, I tried this and it seems to be the case. My error:
```
/nix/store/inkxb5vqy7agpm0wzqk07ha9a9llnfd2-dmd-2.107.1/include/dmd/std/algorithm/iteration.d(6953):
 Error: function `app.main.substitute!((a, b) => a == b, string, string, 
string, string, string, string, string, string, string, string, 
string).substitute.SubstituteSplitter.popFront` cannot access function `find` in 
frame of function `D main`
/nix/store/inkxb5vqy7agpm0wzqk07ha9a9llnfd2-dmd-2.107.1/include/dmd/std/algorithm/searching.d(2388):
        `find` declared here
app.d(8): Error: template instance `app.main.substitute!((a, b) => a == b, string, string, string, string, string, string, string, string, string, string, string)` error instantiating
```

I believe it means `substitute` is not correctly taking context pointers into account.

Reply via email to