Puzzled by this behavior
Adam D Ruppe
destructionator at gmail.com
Tue May 31 17:52:35 UTC 2022
On Tuesday, 31 May 2022 at 17:41:18 UTC, Don Allen wrote:
> This strikes me as pretty inconsistent behavior
Code in functions is actually executed in sequence. Nested
functions aren't exactly code, but the same rule applies to them.
Consider:
int a = 5;
a = 6;
int b = a;
What is b? Of course we know since it happens in sequence. Same
rule applies with nested functions.
> I've also not found it documented, though I could have missed
> it (if someone could point me to where this is discussed, I'd
It has its own section on the function page:
https://dlang.org/spec/function.html#nested-declaration-order
More information about the Digitalmars-d
mailing list