Skip to content
Weaverv0.5.0

A tour of Weaver

This tour teaches Weaver through small programs, each of which you can copy into main.wft and run with wv run main.wft. Every program on these pages is compiled and run by the site’s own checks, so what you read is what the compiler accepts today.

It assumes you know another language: Weaver borrows from Rust, Swift, Scala, Go and TypeScript, and the tour says where it differs from them.

  1. Values and functions: bindings, numbers, strings, functions and how to call them.
  2. Records, enums and optionals: the data a program is made of, and the absence of null.
  3. Control flow and patterns: if, match, loops and ranges.
  4. Collections and sequences: arrays, maps, lambdas and lazy sequences.
  5. Errors: T ! E, ! and catch, instead of exceptions.
  6. Contracts and generics: what a type promises, and code written once for many types.
  7. Values, mutation and resources: how Weaver manages memory without a garbage collector, and what using guarantees.
  8. Understanding memory: where a value lives, who owns it and when it is freed, in diagrams.
  9. Tasks and concurrency: tasks, promises the compiler will not let you forget, cancellation, channels and shared state.
  10. Code that runs at compile time: annotations, meta code and quotes.
  11. Comments and documentation: doc comments the compiler checks, examples that are tests, and wv doc.
  12. Extensions: code compiled apart, that a program loads and reloads while it runs.

When you need the exact rule rather than an introduction, the language reference has it; the guides cover the standard library, files, processes, HTTP, tasks and time.