3.6 Definitions
definition | ||||||||||||
| ||||||||||||
definition | ||||||||||||
| ||||||||||||
| ||||||||||||
|
A bind can be just an identifier or id_name, or it can be constructed with a binding operator, such as a pattern form or :: for annotations. The number of result values must match the number of binds. Static information is gathered from rhs_expr or body and propagated to lhs_bind as described in Rules for Static Information).
An identifier is bound in the expr space, and most binding operators also create bindings in the expr space.
When def is used with =, then rhs_expr must not contain any immediate = terms (although = can appear nested in blocks, parentheses, etc.). When a def group both contains a = and ends in a block, the block is treated as part of an rhs_expr after the =.
> block:
fun get_v(): v
[get_v(), v]
[1, 2]
See Namespaces for more information about extending namespaces.
> namespace geometry:
pi
> geometry.tau
6.28