v3 Capstone: Full Pipeline
- Trace returned closures and container aliases through every stage.
- Classify static name errors versus dynamic call/index errors.
- Construct observable assertions and repeat-run isolation checks.
1 / 6
fn make(start) {
var n=start;
fn next(){ n=n+1; return n; }
return next;
}
let c=make(10);
let values=[c(),c()];
if (values[0]!=11) { 1/0; }
if (values[1]!=12) { 1/0; }
Parsing represents c() with a callee expression. Analysis resolves n through the nested scopes, and permits c to hold a callable value. Compilation reserves function IDs and emits closure creation; BC2 transports code and IDs, not live environment pointers. The VM creates environments when executing make and next. The two calls share one captured n and construct array [11,12]. Both assertion branches are skipped, and ordinary top-level completion returns nil.
The same source called again through CompileAndRun creates a fresh VM and starts again at n=10. Reusing the previous global environment would violate this invocation boundary. A standalone GC test is still needed to prove reclamation and transitive retention; capstone success alone does not do so.
The counter returns 11 twice after a compiler/runtime refactor, while its BC2 still contains the same function IDs. List the environment evidence needed before changing the parser.
Create two independent returned closures stored in a map. Invoke one twice and the other once; assert their distinct histories using conditional division-by-zero failures. Predict the result of running the complete program twice.
Carry verified callable-value and heap behavior into v4. The next milestone changes branches and loop exits, so preserve these earlier regression programs while adding new path tests.