← All docs
substr() — internals
Compiler internals for substr(): lowering path, type checks, and runtime helpers.
substr() — internals
Where it lives
- Signature:
src/builtins/string/substr.rs - Lowering:
src/codegen/lower_inst/builtins/strings.rs:775 (lower_substr) - Function symbol:
lower_substr()
Lowering notes
- Lowers
substr(string, offset, length?)with target-local pointer arithmetic.
Runtime helpers
The following runtime helpers are referenced:
__rt_substr_replace
Signature summary
function substr(string $string, int $offset, int $length = null): string
What the type checker enforces
- Arity: takes 2–3 arguments (1 optional).
Eval interpreter (magician)
- Declaration:
crates/elephc-magician/src/interpreter/builtins/string/substr.rs(eval_builtin!) - Dispatch hooks:
direct,values