← All docs
unset() - internals
Compiler internals for unset(): lowering path, type checks, and runtime helpers.
unset() - internals
Where it lives
- Signature:
crates/elephc-builtin-contract/src/catalog_surfaces.rs - Lowering:
src/codegen/lower_inst/builtins/types.rs:141 (lower_unset_builtin) - Function symbol:
lower_unset_builtin()
Lowering notes
- Rejects
unset()calls that were not converted into direct EIR unbind operations. - Reaching this lowering means
crate::ir_lower::exprcould not turn the target - into a slot clear, a hash/array removal, an
offsetUnset()call, a__unset() - call or a dynamic-property removal, so the message lists the shapes that do lower
- directly and then names the one shape users hit most.
- Fixed untyped slots selected by reachable property
unset()operations are widened to - boxed
Mixedand lowered throughPropUnset, so they do not reach this fallback. Packed - fields, by-reference property slots, and dynamic shapes whose magic behavior depends on
- runtime state remain deliberately unsupported.
- A BY-REFERENCE INDEXED ARRAY is the shape named here.
unset()removes a key without - renumbering, so a packed list has to become a hash — and a callee cannot retype the
- caller’s slot, which still reads
array<T>. The associative form has no such problem - and lowers directly (issue #677), so the message names the difference rather than
- leaving “array/hash elements” looking like a blanket promise.
Semantic descriptor
Shared contract with a dedicated compiler language-construct implementation.
EIR and runtime boundary
Lowered by a dedicated compiler language-construct path.
Signature summary
function unset(mixed $var, ...$vars): void
What the type checker enforces
- Arity: takes exactly 1 argument.
- Variadic: collects excess arguments into
$vars.
Eval interpreter (magician)
- Declaration:
crates/elephc-magician/src/interpreter/builtins/symbols/unset.rs(eval_builtin!) - Execution: Magician interpreter adapter.
- Adapter reason:
dynamic-language-surface. - Dispatch hooks:
direct,values - Variadic: collects excess arguments into
$vars.