You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the manual: "The order of initialization of the created global variables within a module is not defined, but all of them will be initialized after any top-level variables in their originating module and before any variable in a module that imports it."
proca(): int=echo"a"; 1procb(): int=echo"b"; 2procc(): int=echo"c"; 3var g =a()
procrun() =var x {.global.} =b()
var y {.global.} =c()
run()
The {.global.}s are being initialized before the top-level variable which prevents initializing a value they depend on.
Nim Version
Nim Compiler Version 2.2.0 [Linux: amd64]
Compiled at 2024-10-02
Copyright (c) 2006-2024 by Andreas Rumpf
git hash: 78983f1
active boot switches: -d:release
Current Output
b
c
a
Expected Output
a
b
c
or
a
c
b
Known Workarounds
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Description
According to the manual: "The order of initialization of the created global variables within a module is not defined, but all of them will be initialized after any top-level variables in their originating module and before any variable in a module that imports it."
The
{.global.}
s are being initialized before the top-level variable which prevents initializing a value they depend on.Nim Version
Nim Compiler Version 2.2.0 [Linux: amd64]
Compiled at 2024-10-02
Copyright (c) 2006-2024 by Andreas Rumpf
git hash: 78983f1
active boot switches: -d:release
Current Output
Expected Output
Known Workarounds
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: