On Saturday, 4 October 2025 at 12:40:43 UTC, Brother Bill wrote:
On Saturday, 4 October 2025 at 12:14:06 UTC, Dmitry Olshansky
wrote:
It’s weakly pure in that it could only mutate things that are
passed in. Strongly pure would require no mutable
pointers/slices/references.
It may be misleading that it’s single keyword for both of
these. The good news is that strongly pure functions can call
weakly pure function and stay strongly pure.
So if we don't want to allow mutating passing in parameters,
add 'in' keyword to each parameter. Then it should be strongly
cure. Is that correct?
```
int[] inner(in int[] slice) pure
```
If you want to enforce (and also document) that an parameter is
never changed by the function, you should use `const`. If I'm
reading the spec correctly
(https://dlang.org/spec/function.html#in-params), `in` always
implies `const`, and with the -preview=in compiler switch, it
also implies `scope`