Skip to main content

compile_with_latches

Function compile_with_latches 

Source
pub fn compile_with_latches(
    src: &str,
    latches: &[String],
) -> Result<Expr, ExprError>
Expand description

compile, with a preset’s [latch] names in scope (ADR-0137).

latches is the preset’s latch names in slot order: entry i resolves to LATCH_SLOT_BASE + i, which is the whole of the name-to-slot resolution and it happens once, here, at load — exactly as Binding::tau is read out of [smoothing] once. Nothing per-frame looks a latch name up. Entries past LATCH_CAP are unreachable; the loader rejects them before this is called, and the take below means a caller that did not would get an unknown identifier rather than a slot outside the block.

A latch name is resolved after the constants and the built-in variables, so nothing an author can declare shadows bass or pi. The loader also rejects a colliding name outright, which is what makes this ordering unobservable rather than a silently preferred one.