Skip to content

[Core] Implement executable incant call model with recursion support #14

@jbatte47

Description

@jbatte47

Problem

incant declarations are currently treated more like metadata/patterns than fully executable function values with call frames and lexical environments.

To support real computation (including recursion), incant execution semantics must be formalized.

Scope

  • Implement executable incant call model with:
    • argument binding
    • lexical scope handling
    • return/yield propagation
  • Support guarded recursive calls.
  • Preserve behavior for current non-recursive examples.

Deliverables

  • Runtime call-frame/environment mechanism for incant calls.
  • Tests for direct call, nested call, and recursion with base case.
  • Developer notes describing recursion safety expectations.

Acceptance Criteria

  • Recursive sample program executes correctly with deterministic result.
  • Existing examples continue to run.
  • Runtime remains stable under bounded recursion depth.

Validation Checklist

  • Add recursion fixtures (e.g., factorial-like with base case).
  • Add tests for parameter scoping and return behavior.
  • Run full examples suite.

Non-goals

  • Tail-call optimization.
  • Full closure/lambda language surface.
  • Advanced optimizer work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions