Possible 'pure' bug with int[] slice. Programming in D page 174
Dmitry Olshansky
dmitry.olsh at gmail.com
Sat Oct 4 18:48:15 UTC 2025
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
> ```
Yes that’s it.
More information about the Digitalmars-d-learn
mailing list