The law execution engine requires a language that supports:
A Python prototype exists (engine/) demonstrating the execution model. The question is which language to use for the production implementation.
Use Rust for the law execution engine.
| Requirement | How Rust Addresses It |
|---|---|
| WASM compilation | First-class support via wasm-pack and wasm-bindgen. Produces small, fast binaries. |
| Determinism | Compiler enforces: no implicit type coercion, no null exceptions, exhaustive pattern matching, precise integer types. |
| Type safety | Strong static types catch schema violations at compile time. Result and Option make error handling explicit. |
| AI-aided development | Type system provides actionable feedback loop: generate → compile → fix errors → repeat. |
Additional benefits:
serde provides reliable YAML/JSON parsing with compile-time validation| Tradeoff | Mitigation |
|---|---|
| Learning curve (ownership, borrowing, lifetimes) | AI assistance reduces friction; team can learn iteratively |
| Slower iteration (compile times) | Incremental compilation; WASM hot-reload tooling exists |
| More verbose than Python | Explicitness is a feature for legal code; reduces ambiguity |
| Smaller ecosystem than Python for data processing | Core requirements are well-supported |
Alternative 1: Python (keep current prototype)
Alternative 2: TypeScript
"1" + 1 = "11")null vs undefined ambiguityAlternative 3: Go
Rust works well with AI code generation:
match expressions for rule logicThe generate → compile → fix cycle with Rust is faster than generate → run → debug with dynamic languages.
An exploration by Bureau Architectuur of the Dutch Ministry of the Interior into the possibilities of transparent, executable legislation.
Bureau Architectuur
Ministry of the Interior and Kingdom Relations