Dsxir. RuntimeProgram. Canonical
(dsxir v0.2.0)
Copy Markdown
Canonical IO-list encoding of a Dsxir.RuntimeProgram used as the input to
the SHA-256 content hash that becomes the program's :version.
Determinism rules:
- Map keys are sorted alphabetically before being encoded.
- Atoms are encoded as binaries to avoid coupling to the BEAM atom table.
- Tuples are encoded as
["__tuple__", elems...]. - Non-semantic fields are excluded —
descriptiononFieldSpecand on the program'smetadata. Other metadata is included. - Node and edge order is significant and is preserved verbatim.
- Predicate strings are encoded verbatim; the parsed AST is not part of the hash.
- Inline
Dsxir.Signature.Compiledstructs are encoded by their fields list plus:instruction. Module-atom signatures are encoded by their fully-qualified atom name. - Strings escape
"as\".
Summary
Functions
Encode rp deterministically as an iolist suitable for SHA-256 hashing.
Functions
@spec encode(Dsxir.RuntimeProgram.t()) :: iodata()
Encode rp deterministically as an iolist suitable for SHA-256 hashing.
Same logical content always produces the same bytes; see the rules in this
module's @moduledoc.