Possible 'pure' bug with int[] slice. Programming in D page 174

Dmitry Olshansky dmitry.olsh at gmail.com
Sat Oct 4 12:14:06 UTC 2025


On Saturday, 4 October 2025 at 10:56:09 UTC, Brother Bill wrote:
> Did I discover a bug, or am I misunderstanding intentional 
> behavior?
> I would not expect a 'pure' function to modify a parameter.

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.




More information about the Digitalmars-d-learn mailing list