← All docs

unset() - internals

Compiler internals for unset(): lowering path, type checks, and runtime helpers.

unset() - internals

Where it lives

Lowering notes

  • Rejects unset() calls that were not converted into direct EIR unbind operations.
  • Reaching this lowering means crate::ir_lower::expr could 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 Mixed and lowered through PropUnset, 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)

Cross-references