v6 Capstone: Full Pipeline

  • Explain which type information is checked and then erased.
  • Validate the full pipeline with static and dynamic counterexamples.
  • Demonstrate independent transfer across all six course milestones.
1 / 6

Readiness

  • Complete v6 signatures, contextual type checks, and prior multi-module integration.
2 / 6

Worked reconstruction

module math {
  export fn twice(x:number)->number { return x*2; }
}
module main {
  import math as m;
  let total:number=0;
  for (let i:number=0; i<3; i=i+1) { total=total+m.twice(i); }
  if (total!=6) { 1/0; }
}

Parsing builds both module and type trees. Analysis checks exports, argument and return compatibility, boolean loop conditions, and scope. Compilation uses the already established runtime instructions; it does not emit a second typed VM or serialize all Type trees into BC2. Link relocates later Main jumps and closure IDs; Decode rebuilds code before a fresh VM executes it. The assertion observes total=6; normal top-level completion returns nil.

3 / 6

Diagnose before implementing

An accepted v6 program crashes when a number-returning function falls off its body. A proposed fix removes runtime type checks because the front end already checked the signature. Diagnose the mistaken guarantee.

4 / 6

Independent transfer

Extend the worked program to accept an array through an exported function and aggregate selected values. Give one statically rejected caller and one caller with correct types that fails bounds at runtime. Then propose, without changing the grader contract, what additional analysis would be needed to prevent the latter.

5 / 6

Carry forward

Keep the six-milestone portfolio as a reference for future language work. A next project can deliberately add precise capture resolution, stronger type guarantees, richer diagnostics, optimization, or native code generation, with new contracts and independent tests.

6 / 6
←/→ or click edges to navigate · ? help · N notes · F fullscreen