pub struct Def {Show 17 fields
pub name: Arc<str>,
pub typarams: Vec<Arc<str>>,
pub params: Vec<(VarId, Arc<str>, Ty)>,
pub ret: Ty,
pub body: Core,
pub tier: Tier,
pub effects: Vec<Effect>,
pub row: Row,
pub declared_effects: Vec<Effect>,
pub bounds: Vec<(Arc<str>, Vec<Arc<str>>)>,
pub row_is_declared: bool,
pub tier_is_annotated: bool,
pub tier_is_written: bool,
pub is_declaration: bool,
pub declares_signal: bool,
pub span: Span,
pub tier_span: Span,
}Fields§
§name: Arc<str>§typarams: Vec<Arc<str>>The names in def map[T, U](…), in the order written.
Carried on the Def rather than left in the scheme because beck iface publishes it: a
.becki line that dropped the [T, U] would read back as a signature mentioning two types
nobody declared (docs/27 §27.2).
params: Vec<(VarId, Arc<str>, Ty)>§ret: Ty§body: CoreThe whole definition as a lambda, so evaluating the name yields a callable value.
tier: Tier§effects: Vec<Effect>The inferred row’s atoms, resolved and sorted — what placement and the infrastructure derivation read.
row: RowThe inferred row itself, variables and all. This is the signature §3.6 publishes.
declared_effects: Vec<Effect>What the signature declared with uses, if anything.
bounds: Vec<(Arc<str>, Vec<Arc<str>>)>The trait bounds on this definition’s type parameters, in written order.
Empty for almost everything. A bounded definition is published — beck iface writes
def total[T: Priced](xs: list[T]) -> Int, bound and all — and the importer rebuilds the
dictionary parameters this module lowered it with from that bound
(Checker::import_bounded). It is the bound that crosses rather than the lowered
parameters, whose names no source could write.
row_is_declared: boolTrue when the signature stated its row — so an empty one is a bound of “performs nothing” rather than an absent declaration.
A hand-written def with no uses has this false, because writing nothing means “infer
it”. A trait method’s row is stated by the trait, empty or not, so every impl method has it
true: otherwise def show(self) -> Str would let one implementation reach for a clock and
every caller of show would inherit it silently.
tier_is_annotated: boolTrue when this definition’s tier is a given rather than something to solve for (§3.4).
An @on(...) in the source sets it, and so does crate::project’s linker, for every
definition that arrived from another module: an imported placement is part of a published
signature and the root’s solve must not move it. So it answers “may the solver place this?”
and not “did somebody write it down” — tier_is_written is the
second question.
tier_is_written: boolTrue when this module’s source wrote the annotation.
Set once, by the checker, and never overwritten, which is the difference that matters:
after linking, every definition in the program is annotated in the sense above, and an
editor offering to write down the tier it inferred would offer it for definitions that
already say (crate::editor::Editor::hints).
is_declaration: boolA signature with nothing behind it: a line of a .becki interface, or a trait’s method.
declares_signal: bool@signal — a declaration that publishes a signal rather than a function (§3.6).
span: Span§tier_span: Span