Summary
Functions cannot reference other functions defined later in the same file, making mutual recursion impossible.
Reproduction
function is_even(n: int) -> bool:
if n == 0:
return true
return is_odd(n - 1) # Error: undefined function: is_odd
function is_odd(n: int) -> bool:
if n == 0:
return false
return is_even(n - 1)
Expected behavior
Functions should be able to call each other regardless of definition order, either via:
- Two-pass resolution — collect all function signatures first, then resolve bodies
- Forward declarations — explicit
declare function is_odd(n: int) -> bool
Impact
Mutual recursion is a common pattern for state machines, parsers, and tree traversal algorithms.
Summary
Functions cannot reference other functions defined later in the same file, making mutual recursion impossible.
Reproduction
Expected behavior
Functions should be able to call each other regardless of definition order, either via:
declare function is_odd(n: int) -> boolImpact
Mutual recursion is a common pattern for state machines, parsers, and tree traversal algorithms.