Bounded state-carrying iteration (fold)

Open
#268 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
compilers

Research direction

Start with crates/edict-syntax/src/core_ir.rs and the existing CoreNode::For representation, then trace its compiler handling and target lowering. Define the bounded fold contract across Core representation, lowering and independent verification, including its state, cost and termination rules. Done means the explicit Core capability enforces the stated bounds and supports the iterative rope consumer; the issue names no tests to run.

Written by the indexing model from the issue text.

Description

Edict locals are immutable and there is no assignment; the spec says accumulation uses bounded folds, but the closed prelude has no fold, and CoreNode::For has a binder, iterable, bound and body with no initial accumulator, next state or result (crates/edict-syntax/src/core_ir.rs; the compiler gives the body a nested environment and a Null result). Target lowering also refuses For.

Needed: one narrow first-order mechanism, conceptually s(i+1) = step(s(i)) for 0 <= i < N with a statically established ceiling N, a bounded state type and a statically known step. Its contract must settle:

  • initial state and final-result binding;
  • per-step state input and next-state result;
  • deterministic order;
  • state, collection and allocation bounds;
  • completion and failure behaviour, including a terminal state that issues no further reads or effects during remaining iterations (whose overhead still counts);
  • the cost of the step and everything it calls;
  • Core representation, Target lowering and independent verification, declared as an explicit Core capability.

Not wanted: mutable locals, general higher-order functions, unrestricted recursion, or several loop forms. Distinct from #267, which lowers effect-emitting for over already-computed values.

Consumer: Jim's iterative rope (jedit DL-0159; ruling 2026-10-21 chose iterative descent and rebuild over bounded paths instead of recursive types). Descent carries current node, remaining offset, accumulated path and completion state; rebuild folds over the collected path.

Dominant language
Rust
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from flyingrobots/edict

All issues in flyingrobots/edict

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.