Skip to content

Latest commit

 

History

History
10 lines (6 loc) · 955 Bytes

File metadata and controls

10 lines (6 loc) · 955 Bytes

glaze

Serialization/deserialization between typed NimNodes and compile time values. Use cases include:

  • storing values to/loading values from macrocaches
  • reading static/const values from custom pragma argument nodes or other typed AST

Unlike macros.newLit (which only does serialization), AST is generated to be "reversible" via the deserialization procs. Like macros.newLit, the serialized AST also works as literals for the serialized values. Deserialization also supports the AST of typed static values/constants, which is not always valid AST in normal code.

Serialization/deserialization of typed NimNodes themselves are also supported, however this is accomplished via a cache that does not shrink, so it is not meant to be overused. Untyped NimNodes can use something like macros.astGenRepr or the nuance library which also works at runtime.