Skip to main content

The Bolt Programming Language

A highly experimental programming language for safe and rapid application development

Secure by design

Whole classes of bugs can't happen in Bolt, because the type checker rules them out before the program runs.

  • There's no null. A value that may be missing is an Option, and the type checker makes you handle None.
  • Whether a value can change is part of its type. An imm array or struct can never change, not even through another name for it, so data you hand out stays as it was.
  • Programs compile to WebAssembly, which runs in a sandbox: compiled code can only reach the outside world through the few functions the host gives it, and every array access is checked.

Performant

Bolt knows every type before the program runs, so the program doesn't have to find them out while it's running.

  • Programs compile ahead of time to WebAssembly, which browsers and runtimes like Wasmtime run at close to native speed.
  • Static types mean no type checks or boxing at run time: an i32 is a machine integer, and a call is a direct call.
  • Arrays and structs are passed by reference, never copied behind your back, and their mutability in the type tells the compiler what can't change.

Productive

Bolt infers the types you leave out, and tells you what's wrong while you type.

  • Write fn first(c) = c[0]; and Bolt works out that it's generic: it takes an array, a Vec, or anything else that can be indexed.
  • A language server reports mistakes in your editor, and in the playground above, with errors that point at the cause as well as the symptom.
  • Run a program right away with bolt run, then compile the same code with bolt build. Enums with data, pattern matching, classes and macros keep the code short.