Version: dev

Load-time lowering and templates

The passes a loader runs before a document is usable: enum lowering, subsystem references, expression templates and coupling imports.

OperationKindBindingsSummary
apply_scope_injectionsfunctionTypeScript, Rustesm-spec §9.7.10 forms A + B: if raw needs a scope-directed injection (a non-empty subsystem-ref edge list injected, or a coupling entry carrying an injection map), return a…
desugar_pushdownfunctionPython, RustRecognise the projection-pushdown pattern in esm’s named model and, when it matches, return a NEW document with the four constructs desugared in (a kind:"derived" index set,…
ephemeral_injected_filefunctionTypeScript, Rustesm-spec §9.7.10 form C: build a throwaway EsmFile in which component mname has the run’s imports (raw §9.7.2 entries) appended to its own expression_template_imports, so…
expand_coupling_importsfunctionJulia, TypeScript, Python, RustExpand every CouplingImport entry in file.coupling into concrete edges, splicing them in the position of the import entry (esm-spec §10.10.3).
expand_documentfunctionTypeScript, PythonFully expand every surviving apply_expression_template reference in a document loaded by lowerExpressionTemplates (Option B), producing the Option-A image: every reference…
is_coupling_library_docfunctionTypeScript, Python, RustTrue when raw has the coupling-library-file FORM (top-level coupling_roles, esm-spec §10.9).
is_template_library_docfunctionTypeScript, RustTrue when raw has the template-library-file FORM (top-level expression_templates, esm-spec §9.7.1).
lower_enumsfunctionJulia, TypeScript, Python, Rust, GoThe PURE form: return a DEEP COPY of file with every enum op replaced by the const integer the file’s enums block assigns it, leaving file untouched.
lower_enums_mutfunctionPython, Rust, GoIn-place twin of lower_enums: lower every enum op in file itself, and return it (API_SPEC.md §8 item 15).
lower_expression_templatesfunctionJulia, TypeScript, Python, GoRun the §9.6.3 rewrite fixpoint over raw_data against each component-local expression_templates block (esm-spec §9.6.4, Option B): auto match rules fire, EAGER…
materialize_value_inventionfunctionPython, RustRun the build-time value-invention engine over a raw model document.
resolve_subsystem_refsfunctionJulia, TypeScript, Python, Rust, GoResolve all subsystem references in-place.
resolve_template_machineryfunctionJulia, TypeScript, Python, RustResolve every esm-spec §9.7 construct of the ROOT document raw_data (relative import refs resolve against base_path): imports recursively with per-edge instantiation,…
value_invention_resulttypePython, RustResult of materialize_value_invention.
circular_reference_errorerrorTypeScript, PythonError thrown when a circular reference is detected during subsystem resolution.
enum_lowering_errorerrorJulia, TypeScript, Python, Rust, GoRaised when enum lowering (esm-spec §9.3) fails, carrying the stable diagnostic code as a structured field rather than interpolated into the message — the same shape as…
expression_template_errorerrorJulia, TypeScript, Python, GoException raised when a load-time lowering pass fails: expression-template expansion (esm-spec §9.6), template-library imports (§9.7), coupling-library imports (§10.9–§10.11),…
subsystem_ref_errorerrorJulia, PythonException thrown when subsystem reference resolution fails.
value_invention_errorerrorPython, RustA value-invention build-time materialisation error.
max_template_expansion_depthconstantTypeScript, Python, GoMaximum template-body reference-chain depth (counted in TEMPLATES along the longest chain, so a 33-template chain is rejected while a 32-template chain is accepted) before a file…

All topics