Skip to main content

Module prefix

Module prefix 

Source
Expand description

THE EMISSION PREFIX — the mark every name this crate mints into a declaration’s own scope wears, and the seat a domain framework building these models sets to its own. The EMISSION NAMESPACE: the mark every name this crate mints into somebody else’s scope wears, held as ONE value a front end sets rather than as a constant each mint re-spells.

§What the seat is FOR, and who the second occupant is

This crate is model in, tokens out — the derive builds a model today, and ingraph-compiler will build one from a manifest. Both of those are ingraph’s own front ends and both want __ig. The occupant this seat exists for is the third: a DOMAIN FRAMEWORK that depends on ingraph-codegen directly, builds the same models, and emits them under its own name — mediagraph-codegen is the first, and it passes __mg.

Without the seat that framework’s expansions would carry ingraph’s mark on every name they put in an author’s scope, which is wrong twice over: the names read as another crate’s, and the FENCE that makes them safe is a fence the other framework’s derive is not holding. A namespace is minted in and refused in by the same party or it is not a namespace at all — see EmissionPrefix::refused, which is the half a front end spends before it ever reaches a mint.

One deployment may hold raw-ingraph records beside a platform’s, and their names are per DECLARATION rather than per build: a __ig_key__ field on one record and a __mg_key__ field on the next are two expansions of two models, and nothing downstream is entitled to assume a single mark. A cfg or a crate-wide constant would have made that arrangement unrepresentable; a field on the model makes it the ordinary case.

§WHAT IS AND IS NOT INSIDE THE SEAT

The seat covers every name that lands in a SHARED namespace — the declaring module’s scope, a database catalog, a wire face, or an emitted public API. Those are the names a second framework could stand beside, so those are the names a second framework must be able to move.

It does NOT cover a name minted inside an anonymous const _: () = { … } block or bound by a let in a generated function body. Two expansions cannot see one another’s anonymous const, so there is nothing there for a mark to separate — __ig_says_goodbye in crate::emit and __ig_row in crate::aggregate are spelled once, collide with nothing, and stay as they are. The tell is the FRAME: a name in the shared namespace wears __ at both ends, and every one of those is threaded here.

Structs§

EmissionPrefix
The mark a framework’s emitted names are minted under — __ig for ingraph itself.