# `Schooner.Compiled`
[🔗](https://github.com/ausimian/schooner/blob/1.1.0/lib/schooner/compiled.ex#L1)

Opaque artifact produced by `Schooner.compile/2` and consumed by
`Schooner.run_compiled/2`.

A `%Compiled{}` holds the **analysed core IR** of a program
together with the **runtime variable bindings** that the program's
`(import ...)` declarations resolved to at compile time. Macros are
already gone — `let`, `cond`, `when`, `case`, etc. have been
rewritten into `quote` / `if` / `lambda` / `define` /
`define-values` / `begin` / `letrec*` / `quasiquote` / `guard` /
application / variable references — and those core forms have been
pre-analysed into the evaluator's tagged IR, so lambda parameter
parsing and body desugaring are not repeated per run.

## Reuse semantics

The same `%Compiled{}` can be passed to `Schooner.run_compiled/2`
many times against many `Schooner.Environment`s, which is what
makes it worth caching. The captured `var_bindings` are re-applied
to the runtime env on every call; macros expanded at compile
time stay expanded.

Macro expansion is fixed at compile time: running the program
against an `Environment` whose macros differ from the one passed
to `compile` does not re-expand it. Variable bindings can differ
freely, so host primitives can be swapped between runs. The
program's own `(import ...)` bindings are re-applied on each run
and shadow any same-named binding in the runtime environment.

## Opacity

Embedders must treat the struct as opaque. Pattern-matching on
its internals is unsupported, because their shape changes with
the evaluator's internal representation.

# `t`

```elixir
@opaque t()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
