Skip to main content

Declare one

Parameters and the return type are both optional and independently typed. Same shape as Python: def leading, -> for the return type.
A plain function has no permission check and no audit entry — it’s not the right tool the moment a call needs one. See Which keyword do I want?

Inline bodies

Short bodies can skip the indented block:

Closures

A function closes over the scope it was declared in:
Assignment follows the one assignment rule: a function body can mutate a variable from its enclosing scope directly, no nonlocal needed:

Docstrings

A bare string as the first statement of a function’s body is captured as its .doc, same as Python:
"""...""" and "..." both work — plain "..." already tolerates an embedded newline. The text is dedented and trimmed for you. No docstring? .doc is nil, never an error. tool, action, and agent bodies work the same way; see them in sense inspect’s panels.

Type checking

Checked at the call site and at return:
Real, but shallow (matches_type() — see Values & Types), not full static inference.

Arity is strict

Every parameter is required, exactly once, no defaults:
(Some builtinsprint, range — are variadic. User-defined functions aren’t, yet.)

Continue

Control flow

if/else, while, for, break, continue.

Actions

Looks like a function, behaves completely differently — for anything that changes the outside world.