pub enum Binding {
Leaf(Expr),
Group(Rc<GroupPlan>),
Inherit,
InheritFrom {
from: usize,
},
}Expand description
A binding after normalization.
Variants§
Leaf(Expr)
A value that is NOT a syntactic attrset literal, so it can never merge.
Group(Rc<GroupPlan>)
A syntactic attrset literal, or an implicit one created by a dotted path. Mergeable — and merging splices into THIS node.
Rc because a consumer clones a sub-plan every time it builds the
nested group lazily; owned, that is a DEEP copy of the whole subtree on
each evaluation. During construction the Rc is uniquely owned, so
Rc::make_mut below is a no-op rather than a copy.
Inherit
inherit x — resolve x in the group’s ENCLOSING scope, never its own
rec scope. That is what makes an inherited binding shadow rather than
self-reference, and why it can never merge.
InheritFrom
inherit (e) x — force GroupPlan::inherit_froms[from], then select.
★ An INDEX, not a cloned expression. One inherit (e) a b c; clause
must evaluate e AT MOST ONCE and share the result across all three
names; cloning the expr per name evaluates it three times, which is
observable through builtins.trace and through any impure source. The
index is per-GROUP because the splice moves a clause between groups.
Fields
from: usizeIndex into the owning GroupPlan::inherit_froms.