Next: Case-Lambda Up: Binding Forms Previous: Fluid-Let

## Syntax Expansion and Internal Definitions

All binding forms are macro expanded into `define-values`, `let-values`, and `letrec-values` expressions. The `set!-values` form is expanded to `let-values` with `set!`. See section 13.4 for more information.

All `define-values` expressions that are inside only `begin` expressions are treated as top-level definitions. Immediate body `define-value` expressions in a `unit` expression are handled specially as described in section 7.1.1. Any other `define-values` expression is either an internal definition or syntactically illegal.

Internal definitions can appear at the beginning of the body in a `lambda`, `case-lambda`, `let`, `let-values`, `let*`, `let*-values`, `letrec`, `letrec-values`, `fluid-let`, `let-macro`, `let-id-macro`, `let-expansion-time`, `parameterize`, or `with-handlers` expression. At least one non-definition expression must follow a sequence of internal definitions.

When a `begin` expression appears within an implicit sequence, its content is inlined into the sequence (recursively, if the `begin` expression contains other `begin` expressions). Like top-level `begin` expressions (and unlike other `begin` expressions), a `begin` expression in an internal definition context can be empty.

An internal `define-values` expression is transformed along with the rest of the expressions following it into a `letrec-values` expression: the variables originally bound by the `define-values` expressions become the binding variables of the new `letrec-values` expression, and the expressions that followed the `define-values` expressions become the body of the new `letrec-values` expression.

Multiple adjacent `define-values` statements are collected into a single `letrec-values` transformation so that the definitions can be mutually-recursive, but the `define-values` expressions really must be adjacent: a `define-values` expressions following a non-`define-values` expression is not an internal definition.

An internal definition cannot shadow a syntax form or macro name. Thus, an internal definition cannot alter the decision of whether another expression is also an internal definition in the same `letrec-values` transformation.

Internal macro definitions (using `define-macro`) are described in section 13.1.