Creating const in a macro fails in 1.9.1

2022-12-28 Thread jyapayne
In addition to @Hlaaftana's answer, if you don't need the data at compile time, you can do this to get it at runtime: import std/tables import macros import print type Metadata = object name: string id: BiggestInt var ALL_METADATA* = in

Creating const in a macro fails in 1.9.1

2022-12-28 Thread yister
Cool, thanks, makes sense, and it worked!

Creating const in a macro fails in 1.9.1

2022-12-28 Thread Hlaaftana
I think the new behavior is correct here. `const ALL_METADATA = allInfo` evaluates before any changes to `allInfo`, so the value of ALL_METADATA is locked in. You can use something like template saveMetadata() = const ALL_METADATA {.inject.} = allInfo Run and c

Creating const in a macro fails in 1.9.1

2022-12-27 Thread yister
Not quite sure where to go with this, and whether it's something I'm doing wrong, or some behavior that changed in the new (rc) version, so figured I'd give the forum a shot. I'm trying to register some types and associated metadata during compile time, and that worked fine in 1.6.8. I also see