Skip to content

Latest commit

 

History

History
256 lines (201 loc) · 9.67 KB

File metadata and controls

256 lines (201 loc) · 9.67 KB

Loon Roadmap

v0.1 shipped. Here's what's next.

What's done (v0.1)

  • Logos lexer, recursive descent parser, AST
  • Tree-walking interpreter with 30+ builtins
  • Hindley-Milner type inference (Algorithm W)
  • Ownership & borrowing checker (lexical)
  • Algebraic effects with one-shot continuations
  • REPL with time travel and forking
  • Basic WASM codegen (integers, functions, strings, println)
  • CLI: new, run, build, check, test, repl, explain
  • 45 tests passing

What's done (v0.2)

  • Destructuring in let: [let [x y] point], [let {name age} user]
  • Destructuring in fn params: [fn [[k v]] ...]
  • Exhaustiveness checking for match (ADT constructors)
  • WASM indirect calls + environment passing for closures
  • Lambda lifting for simple cases
  • [use module.path], [use module {item1 item2}] (interpreter)
  • File = module convention (interpreter)
  • [pub defn ...] / [pub type ...] visibility (interpreter)
  • Multi-file execution (interpreter, with cycle detection + caching)
  • Result / Option as proper ADTs (in prelude)
  • String: join, trim, starts-with?, ends-with?, replace
  • Vec: zip, flatten, chunk, reverse, drop, find
  • Map: keys, values, merge, remove
  • Pipe operator type checking
  • word-count.oo working
  • Clippy warnings clean

v0.2.1 — Close the gaps

What's left to finish v0.2 properly.

Module system in type checker & codegen

  • [use ...] resolved during type checking (cross-file inference)
  • [pub ...] visibility enforced in type checker
  • Multi-file compilation to WASM (module linking/bundling)

Closure capture classification

  • Ref vs move capture analysis (integrate with ownership checker)

v0.3 — Types get serious

Traits / protocols

  • [trait Display [fn display [self] → String]]
  • [impl Display Shape ...]
  • Trait-based operator overloading (Add, Eq, Ord)
  • Trait bounds in type inference

Advanced type features

  • Typed AST (separate from untyped — type checker produces typed tree)
  • [sig] assertions checked against inferred types
  • Row polymorphism for maps/records
  • Type error messages with source spans (integrate with codespan-reporting)

Ownership improvements

  • Borrow inference per-parameter (read-only → immutable borrow, mutates → mutable borrow, escapes → move)
  • Copy types: primitives auto-copy, [derive Copy [type ...]]
  • Better error messages: what/why/how format with visual ownership diagrams

v0.4 — Effects for real

Full effect system

  • Effect inference: calling IO.read-file propagates IO to caller
  • Effect annotations checked: / {IO Fail} verified against inferred set
  • ? desugaring: [expr]? → match on Result, perform Fail on Err
  • Partial handling: handle some effects, pass others through

Built-in effects

  • IO: file read/write, stdin/stdout, env vars (via WASI)
  • Fail: Result integration, ? sugar
  • Async: placeholder runtime handler, mock handler for testing
  • Channels: [let [tx rx] [channel]], [send tx val], [recv rx]

Physics type system (v0.4.22)

  • Dimension struct with SI exponents (mass, length, time, current, temperature)
  • Type::Dim variant in type system — compile-time dimensional analysis, zero runtime overhead
  • Literal unit suffixes: 5.0m, 9.81kg, 10kN desugar to [unit value :keyword]
  • 30+ units with SI prefixes (m, km, cm, mm, s, ms, kg, g, N, kN, Pa, MPa, GPa, J, W, kW, Hz, A, mA, V, C, ohm, K)
  • 21 named quantities (Velocity, Force, Energy, Power, Pressure, Density, etc.)
  • No-dimensionless rule: Dim÷Dim → Scalar (not Float), explicit magnitude to exit
  • Physics effect (gravity, yield-strength, elastic-modulus, density, temperature, thermal-conductivity)
  • Sim effect (stress, deflection, natural-freq, thermal-field) — bridge point for phyz
  • Dimensional polymorphism: [fn double [x] [* 2.0 x]] works on any dimension
  • Physics-aware E0208 errors with named quantities and operation hints
  • 5 physics constants: Const.c, Const.G, Const.h, Const.k-B, Const.e-charge

v0.5 — WASM gets real

Expanded codegen

  • Closures (indirect calls + captured environments)
  • ADTs (tagged unions on the heap)
  • Pattern matching compilation (decision trees + br_table)
  • Persistent data structures (vec-new, vec-push, vec-get)
  • String operations beyond literals (str-len, str-concat, str-eq)
  • WASI integration: file I/O, args, env

Runtime

  • loon run executes WASM via wasmtime (instead of interpreting)
  • loon build --release with tree-shaking
  • Target: hello world < 1KB, fib < 500 bytes

v0.6 — Developer experience

Error messages that teach

  • Three-part errors: what / why / how to fix
  • Visual ownership diagrams in error output
  • [explain EXXXX] interactive REPL tutorials (not just text)
  • Structured errors as data: [catch-errors "[source]"]

LSP server

  • Go-to-definition
  • Type-on-hover (the invisible type system, made visible)
  • Autocomplete
  • Inline diagnostics
  • Inlay hints for inferred types (the three rendering modes from DESIGN.md)

Formatter

  • loon fmt — deterministic structural formatting
  • No config, no debates — one true style

Tree-sitter grammar

  • Syntax highlighting for editors

v0.7 — Macros

Hygienic macros

  • [macro when [condition & body] ...]
  • Quasiquoting: `, ~, ~@
  • Hygiene by default (Scheme-style)
  • [macro+ ...] type-aware macros (run after type inference)

v0.8 — Package Manager

Phase 1 — Manifest, CLI, local deps (done)

  • pkg.oo manifest format (Loon data format, not TOML)
  • loon new, loon init — project scaffolding
  • loon add, loon remove — dependency management
  • Path dependencies: {:path "../my-lib"}
  • Version constraints: ^, ~, >=, =, *
  • Capability grants: :grant #["Net" "IO"]
  • loon audit --capabilities — report effect grants
  • loon why <source> — dependency trace
  • loon search <query> — search package index
  • loon cache clean — clear cache

Phase 2 — Git, URLs, cache, lockfile (done)

  • Domain detection: github.com/user/repo recognized as remote
  • Git fetch: git clone --depth 1 to temp dir
  • URL fetch: HTTP GET + tar.gz extraction (ureq + flate2 + tar)
  • Archive URL derivation for GitHub, GitLab, Codeberg
  • BLAKE3 content-addressed hashing
  • Cache at ~/.loon/cache/blake3/<hash>/
  • lock.oo — lockfile in Loon data format
  • loon add auto-fetches and locks domain-qualified deps
  • loon cache warm — fetch all unfetched deps
  • Feature-gated: pkg-fetch (CLI only, not WASM)
  • Subpath support: github.com/cam/std#http

Phase 3 — Resolution, registry, transitive deps (done)

  • Transitive dependency resolution (parse fetched pkg.oo, resolve recursively)
  • MVS (Minimum Version Selection) across the dep graph
  • loon update — re-resolve and update lock.oo
  • Package registry/index — built-in seed + fetchable remote indices
  • Custom indices via :indices in pkg.oo
  • loon search searches across builtin + custom indices
  • loon why traces transitive dependency chains

Phase 4 — Publish, verify, audit, capability propagation (done)

  • loon publish — create tarball + hash for publishing
  • loon verify — verify cache integrity against lockfile hashes
  • loon audit — full audit: capabilities, transitive grants, cache integrity, lockfile status
  • Hash verification on load (verify cache integrity in resolve_remote_dep)
  • Capability propagation (transitive grant checking)

File extension migration

  • .oo as primary file extension (from l-oo-n), .loon as fallback
  • pkg.oo / lock.oo manifest and lockfile (falls back to .loon)
  • loon new creates .oo files
  • Module resolution tries .oo first, falls back to .loon

Future

  • IPFS distribution

v1.0 — The legendary stuff

Content-addressed definitions

  • Every function/type identified by hash of its AST
  • [hash fn-name], [history fn-name]
  • Rename refactoring doesn't change identity
  • Dead code detection via hash reachability

Incremental computation

  • [memo defn ...] with automatic dependency tracking
  • Salsa-inspired query engine
  • The compiler uses this internally

First-class LLM integration

  • [ai defn ...] — compile-time code generation from prompts
  • [semantic defn ...] — functions implemented by LLM calls
  • [agent ...] — agent loops as a language primitive
  • [#[tool] defn ...] — auto-generate tool schemas from types
  • ai.extract — structured output via type → JSON schema
  • Model config in loon.toml

Persistent data structures

  • HAMT-based persistent vectors and maps
  • Structural sharing, reference counting
  • [Store.open] — transparent persistence to disk

Provenance tracking

  • [#[track] ...] compile-time instrumentation
  • [provenance val] — full origin chain
  • Zero cost for untracked paths

Notebooks

  • .oo.nb — interleaved markdown and code cells
  • Same type/ownership checking as regular files
  • Compiles to WASM

Non-goals for now

  • Native (non-WASM) compilation target
  • Backward compat with any existing LISP
  • GUI framework (provide FFI, frameworks are packages)
  • Multi-shot continuations (one-shot only, like Koka)

Loon: a LISP that flies.