Possible 'pure' bug with int[] slice. Programming in D page 174
Brother Bill
brotherbill at mail.com
Sat Oct 4 12:40:43 UTC 2025
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
```
More information about the Digitalmars-d-learn
mailing list