← All docs
print_r() — internals
Compiler internals for print_r(): lowering path, type checks, and runtime helpers.
print_r() — internals
Where it lives
- Signature:
src/builtins/io/print_r.rs - Lowering:
src/codegen/lower_inst/builtins/debug.rs:34 (lower_print_r) - Function symbol:
lower_print_r()
Lowering notes
- Lowers
print_r(value, $return = false)for concrete scalar/resource values - and array/hash shells.
- Dispatch follows the call’s static result type, which the checker
- (
src/builtins/io/print_r.rs) and the EIR return-type override - (
print_r_builtin_return_type_for_args) derive from the$returnflag: -
Str(literaltrue): render into the capture buffer and return the owned
- string finalized by
__rt_pr_finish. -
Bool(flag absent or literalfalse): render to stdout and returntrue.
-
Mixed(runtime flag): select the mode at runtime; see
lower_print_r_runtime_flag.
Runtime helpers
The following runtime helpers are referenced:
__rt_pr_finish
Signature summary
function print_r(mixed $value, bool $return = false): mixed
What the type checker enforces
- Arity: takes 1–2 arguments (1 optional).
Eval interpreter (magician)
- Declaration:
crates/elephc-magician/src/interpreter/builtins/core/print_r.rs(eval_builtin!) - Dispatch hooks:
direct,values