Skip to content

← All updates

session

Update 12: Safety for the real world

One push turned Fid’s safety story from “memory safe” into “domain safe”. These are compile-time guarantees aimed at the bugs that cost the real world billions.

  • @linear types: move semantics with no duplication. A money value cannot be processed twice; consuming a linear variable inside a loop is a compile error.
  • @conserve: a compile-time financial conservation proof: money in must equal money out. Double-credit and lost-money bugs fail to compile.
  • txn { } blocks: atomic transactions with rollback on failure.
  • @gas(N): compile-time gas budgets for bounded-cost functions.
  • @crashfree: a compile-time proof that a function cannot panic.
  • @audit: automatic function audit logging with parameter values.
  • @medical: IEC 62304-style restrictions: no dynamic allocation, no recursion, no unbounded loops, no unwrap, must be @audit.
  • given / ensure contracts: Design-by-Contract preconditions verified at call sites.
  • Typed strings: SQLString, ShellString, HTMLString, JSONString, PathString. Concatenating user input into a query is a type error, not a code-review hope.
  • Init guarantee: var x: T; without an initializer plus definite-assignment analysis: reading before assignment is a compile error.
  • Checked arithmetic everywhere: integer overflow panics (always on, not just in debug), with @wrapping as the explicit escape hatch. Bounds checks are always on, skippable only inside unsafe { }.
  • Stdlib support: money (fixed-point currency), banking (accounts, transfers, double-credit detection), time (LogicalTime: timezone-free, clock-free deterministic date math), and memo.