Nested function requires forward declaration?
Stanislav Blinov
stanislav.blinov at gmail.com
Thu Apr 14 09:09:19 UTC 2022
On Thursday, 14 April 2022 at 08:55:25 UTC, Chris Katko wrote:
> Using DMD. v2.098-beta-2
>
> Not sure if right terminology. But I just wrote a nested
> function that uses a variable outside its body. The capture
> (right term?) is obvious where the invocation is. However, I
> have to move the declaration of the variable to above the
> nested function for it to compile.
Declarations in function scope are processed in order. This
includes nested functions:
https://dlang.org/spec/function.html#nested (see #8).
More information about the Digitalmars-d-learn
mailing list