Skip to content

feat: capability system Layers 1-4 — effect signatures, fine-grained capabilities, affine types, effect handlers#130

Open
gke0op wants to merge 3 commits into
vercel-labs:mainfrom
gke0op:capability-system-v2
Open

feat: capability system Layers 1-4 — effect signatures, fine-grained capabilities, affine types, effect handlers#130
gke0op wants to merge 3 commits into
vercel-labs:mainfrom
gke0op:capability-system-v2

Conversation

@gke0op
Copy link
Copy Markdown

@gke0op gke0op commented May 19, 2026

Summary

Implements all 4 layers of the capability system design (issue #84), rebased cleanly on latest main (v0.1.3 + TypeScript migration).

Layer 1 — Effect Signatures: raises<io, fs, net> syntax for static effect information.

Layer 2 — Fine-Grained Capabilities: world.fs(), world.net(), etc. derive capability types from World. Removed ambient authority (std.fs.host(), std.net.host()).

Layer 3 — Affine Capabilities: Capability types are affine — no duplication, no global storage. CAP001 diagnostic.

Layer 4 — Effect Handlers: effect Http { fun fetch(...) -> T } declarations and with Http handledBy { ... } handler expressions. EFF001 diagnostic.

Elegance Improvements:

  • Declaration-based capabilities (capability Fs, capability Net, etc.)
  • Unified type checking via type_is_capability()
  • Clean memory management in z_free_program()

Changes

40 files changed across compiler (zero.h, checker.c, ir.c, main.c, parser.c, lexer.c), conformance tests, examples, docs, and scripts.

Testing

  • All existing examples updated to use world.fs() instead of std.fs.host()
  • Conformance tests updated
  • Clean merge against latest main (verified locally)

Replaces

This PR replaces the previous separate PRs (#86, #90, #94, #99, #117) which had merge conflicts.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

@gke0op is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

gke0op added 3 commits May 19, 2026 20:39
Implements all 4 layers of the capability system design (issue vercel-labs#84):
- Layer 1: Effect signatures (raises<io, fs, net>)
- Layer 2: Fine-grained capabilities (world.fs(), world.net(), etc.)
- Layer 3: Affine capabilities (no duplication, CAP001 diagnostic)
- Layer 4: Effect handlers (effect decl + with handledBy expr)

Plus declaration-based capabilities for extensibility.

Rebased cleanly on v0.1.3 (origin/main).
@gke0op gke0op force-pushed the capability-system-v2 branch from f791a5d to 0dd7b13 Compare May 19, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant