Thread overview
[Issue 24096] a pure function is in fact impure for local automatic external variables
Aug 22, 2023
Adam D. Ruppe
August 22, 2023
https://issues.dlang.org/show_bug.cgi?id=24096

Adam D. Ruppe <destructionator@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |destructionator@gmail.com

--- Comment #1 from Adam D. Ruppe <destructionator@gmail.com> ---
I don't understand, what is the bug supposed to be here?

D's pure functions are allowed to use references passed to them, which includes the local variables for nested functions.

--
August 22, 2023
https://issues.dlang.org/show_bug.cgi?id=24096

--- Comment #2 from andreiD@yopmail.com ---

if you ban it, the degegates will fall off?

--
August 22, 2023
https://issues.dlang.org/show_bug.cgi?id=24096

--- Comment #3 from andreiD@yopmail.com ---
(In reply to andreiD from comment #2)
> if you ban it, the delegates will fall off?

--
August 22, 2023
https://issues.dlang.org/show_bug.cgi?id=24096

--- Comment #4 from andreiD@yopmail.com ---
Shouldn't in the delegate, we capture the variable of the function itself where the delegate is called, and not an external variable outside the function!

--