ferrule

ferrule language specification

draft

ferrule language specification

this is the specification for ferrule α1. it describes what the language is and what it will be. each document has front matter that tells you what's implemented, what's planned, and what's been deferred to future versions.

the spec is the single source of truth. if something isn't in here, it's not part of the language yet.

how to read this

each document has yaml front matter at the top:

---
title: some feature
status: α1          # α1, α2, β, or rfc
implemented:        # sections that work right now
  - basic-stuff
  - other-thing
pending:            # sections planned for this phase
  - advanced-stuff
deferred:           # pushed to later phase or rfc
  - complex-thing
---

status meanings:

  • α1 means it's part of the current milestone
  • α2 means next milestone
  • β means later
  • rfc means it's a proposal, not committed

conventions:

  • code for syntax and identifiers
  • [link](path) references the canonical definition
  • examples are runnable unless marked otherwise

design pillars

these are the core ideas that guide decisions:

  1. immutability first - const by default, var when you need mutation, inout for explicit by-reference
  2. errors as values - no exceptions, typed error domains, lightweight propagation
  3. explicit effects - functions declare what they do, async is just another effect
  4. scoped ownership - views can't escape their scope, no borrow checker, no gc
  5. capability security - no ambient authority, fs/net/clock/rng are values you pass
  6. strict nominal types - types with the same shape aren't compatible
  7. no implicit coercions - booleans, numbers, nullability all explicit
  8. explicit polymorphism - records + generics, no traits or oop

what's in α1

the core language that you can actually use:

featurestatus
primitives (i8-i128, u8-u128, f32/f64, bool, char, string)implemented
records and discriminated unionsimplemented
pattern matching with exhaustivenessimplemented
basic generics (monomorphization)partial
error handling (ok/err/check/ensure)implemented
effects (declaration, subset rule)partial
move semanticsplanned
capabilities (with cap syntax)planned
unsafe blocksplanned
basic stdlibpartial

what's deferred

these features are designed but not part of α1:

featuretargetnotes
regions (heap, arena)α2memory allocation model
views (fat pointers)α2with escape analysis
capability attenuationα2restrict, compose
comptimeα2compile-time evaluation
test frameworkα2test blocks, ferrule test
structured concurrencyβtask.scope, spawn, await
async (suspend effect)βeffect-based, pluggable runtimes
hktrfchigher-kinded types
mapped typesrfctype transformation
conditional typesrfcplanned
variadic genericsrfcplanned

looking for future features? check out the rfcs for proposed additions to the language.

specification index

core language

documentscope
core/lexicalsource encoding, identifiers, keywords, comments
core/typesscalars, compounds, unions, nominal typing
core/declarationsconst, var, inout, move semantics
core/control-flowif, match, for, while, break, continue
core/genericstype parameters, constraints

functions and effects

documentscope
functions/syntaxfunction declaration
functions/effectseffect system, standard effects

error handling

documentscope
errors/domainserror types, domains as unions
errors/propagationok, err, check, ensure

memory model

documentscope
memory/ownershipmove semantics, copy vs move
memory/regionsregion kinds, creation, disposal
memory/viewsview formation, slicing, bounds

modules and capabilities

documentscope
modules/packagespackage structure, deps.fe
modules/importsimport syntax
modules/capabilitiescapability parameters, with cap syntax

unsafe

documentscope
unsafe/blocksraw pointers, extern calls

concurrency (β)

documentscope
concurrency/taskstask.scope, spawn, await
concurrency/determinismtest schedulers

advanced (α2+)

documentscope
advanced/comptimecomptime functions, reflection
advanced/ffic abi, extern

reference

documentscope
reference/grammarcomplete ebnf grammar
reference/keywordsreserved words
reference/stdlibstandard library surface

key decisions

these are the choices that define ferrule:

topicdecision
equalitysingle == operator, no ===
functionsfunction keyword for all, no arrows, no fn
polymorphismrecords + generics, impl/derive sugar in α2
memoryscoped ownership + move semantics, no borrow checker
capabilitieslinear, can't store/return, with cap syntax for main
effectsseparate from capabilities, subset rule enforced
errorserror types, domains as unions, context frames debug-only
inferenceunambiguous literals ok, boundaries need annotation
unsafeblocks enable raw pointers/extern, don't disable other checks

to be defined

these decisions are still open:

topicoptions
integer overflowwrap in release, trap in debug (zig-style)
division by zerotrap
out of boundstrap in debug, undefined in release
error recoveryhow many errors before bail, cascading strategy

language identity

ferrule is a systems language where effects and capabilities are first-class. you get low-level control with safety guarantees about what code can do, not just what memory it touches.

target users:

  • embedded developers who want more safety than c
  • security-critical systems where capability audit trails matter
  • developers who want rust-style safety without fighting the borrow checker

what it's not:

  • not rust (no borrow checker, simpler generics)
  • not zig (effects and capabilities are language features)
  • not go (no gc, explicit error handling)

On this page