Silt Language Guide

Silt is a statically-typed, expression-based programming language with full immutability, pattern matching as the way to branch, and CSP-style concurrency. File extension: .silt.

This guide is split into focused pages:

Language Features

  • Bindings and Functions — let, fn, closures, trailing closures, early return
  • Types — primitives, enums, generics, records, tuples, recursive types, type ascription
  • Generics — type parameters, constraints, bounded polymorphism, type-directed dispatch
  • Pattern Matching — match, literals, constructors, tuples, records, lists, maps, or-patterns, guards, ranges, pin, as, when/else, exhaustiveness
  • Error Handling — Result, Option, ? operator, when let-else, Never type
  • Collections — lists, maps, sets
  • Repeating, Pipes, and Other Features — pipe operator, string interpolation, repeating (library iteration, functions that call themselves, the recursion check, the frame budget), ranges, comments
  • Operators and Precedence — full operator table, precedence, associativity, newline rules
  • Traits — declaration, implementation, Self type, built-in traits, where clauses
  • Functors — traits of type constructors: Functor, Applicative, Monad, traverse and sequence, the laws
  • Modules — file-based modules, imports, built-in modules, standard library
  • Testing — test runner, assertions, file and function conventions
  • Error Codes — what each diagnostic code (E0301, …) means

Design

  • Language card — the syntax in brief and every builtin signature, on one page
  • Concurrency — CSP model, tasks, channels, select, fan-out patterns
  • Why silt — how silt compares to Rust, Go, Gleam and OCaml
  • Editor Setup — the language server, VS Code, Neovim and Vim
  • FFI — embedding silt in a Rust program, and Rust functions for silt

Standard Library

Each built-in module has a reference page: its types, a table of its functions, and a section for each function with its signature and an example. An editor shows the same text when you hover a name.

  • Globals — the prelude: print, println, panic, Option, Result, the types that need no import
  • Errors — the error enum of each module, and matching on its variants
  • list, map, set — the collections
  • string — inspecting, slicing, splitting and building strings
  • int / float — parsing, converting and the limits of numbers
  • math — roots, powers, logarithms, trigonometry, constants
  • result / option — combinators of Result and Option
  • bytes — byte strings, hex and base64
  • url — URLs: reading, building and escaping them
  • crypto — hashes, HMAC, random bytes
  • uuid — making, parsing and checking UUIDs
  • regex — regular expressions
  • json, toml, csv — reading and writing text formats into typed values
  • time — instants, dates, durations, formatting and parsing
  • io / fs / env — files, stdin and stderr, the file system, environment variables
  • process — the exit code of the program
  • channel / task — channels and tasks
  • stream — sources, transforms and sinks over channels
  • http — an HTTP client and server
  • tcp — TCP listeners and connections, TLS
  • postgres — a PostgreSQL client with a pool, transactions, cursors and notifications
  • test — the assertions of silt test