The ASDF Standard provides a core/constant schema: https://www.asdf-format.org/projects/asdf-standard/en/latest/generated/stsci.edu/asdf/core/constant-1.0.0.html
I'm a little unclear on its use case, though it appears to be primarily informational. The Python asdf package implements it as a Constant type which provides a "read-only" wrapper around the tagged value. The use of scare-quotes comes from the fact that any YAML value can be tagged !core/constant-X.Y-Z, including sequences and mappings, though the Python implementation does not make any effort to convert these to read-only types (e.g. a tuple and frozendict respectively). It probably should do that, though in practice this is probably most often used in conjunction with scalar values.
The important thing here is that libasdf supports round-tripping a value tagged !core/constant when reading in the tree and writing it back out again, as well as inserting constants into the tree. Most likely as a thin wrapper around an asdf_value_t; schematically:
typedef struct {
const asdf_value_t value;
} asdf_constant_t;
The ASDF Standard provides a
core/constantschema: https://www.asdf-format.org/projects/asdf-standard/en/latest/generated/stsci.edu/asdf/core/constant-1.0.0.htmlI'm a little unclear on its use case, though it appears to be primarily informational. The Python
asdfpackage implements it as aConstanttype which provides a "read-only" wrapper around the tagged value. The use of scare-quotes comes from the fact that any YAML value can be tagged!core/constant-X.Y-Z, including sequences and mappings, though the Python implementation does not make any effort to convert these to read-only types (e.g. atupleandfrozendictrespectively). It probably should do that, though in practice this is probably most often used in conjunction with scalar values.The important thing here is that libasdf supports round-tripping a value tagged
!core/constantwhen reading in the tree and writing it back out again, as well as inserting constants into the tree. Most likely as a thin wrapper around anasdf_value_t; schematically: