Functions¶
Accepted
Complete for V1 function and call source semantics; error-set details are tracked by Errors.
This folder documents Catalyst function declarations, calls, parameters, comptime fn callability, function types, function pointers, default parameters, error returns, and inference.
Read In This Order¶
- Function Shape and Capabilities: declaration shape, capability parameter convention, concrete context records, and structural capability constraints.
- Destructuring Parameters: struct and array destructuring in parameter binding sites.
- Function Types and Pointers: function type expressions, function item values, C-like function pointers, method pointers, calling conventions, and function type identity.
- Default Parameters: default value rules, suffix omission, and default/capability interaction.
- Error Returns and Inference:
T!E,T!,T!Error,main, and signature inference.
Boundary¶
V1 includes:
- named function declarations
- compile-time-only function declarations
- methods as ordinary receiver-first functions
- expression-bodied arrow functions
- destructured parameters
- default parameters
- function item values
- C-like function pointers for concrete signatures
Deferred:
- anonymous function expressions, bound method values, closures, and captures: CEP-0017: Function Literals and Callable Values
- overload sets: CEP-0004: Function Overloading
- named arguments: CEP-0015: Named Arguments
comptimeparameter inference: CEP-0016: Generic Parameter Inference- comptime-only contract operations: CEP-0034: Comptime-Only Contract Operations
- function-value behavior for defaults: CEP-0017: Function Literals and Callable Values