Skip to content
Weaverv0.5.0

Weaver

A natively compiled, statically typed language, without a garbage collector or exceptions, whose compiler runs the language itself.

The code that derives a serializer, a router or a command line from a type is written in Weaver, and runs at compile time:

import weaver.io.print
import weft.json.{Json, JsonError}
/// A release, read from JSON by the code #Json derives at compile time.
#Json
type Release = { tag: String, assets: String[] }
fn main() ! JsonError {
val r = Json.decode<Release>("{\"tag\": \"v0.1.0\", \"assets\": [\"install.sh\"]}")!
print("${r.tag}: ${r.assets.len()} asset(s)")
}

One language, two moments

meta code, at compile time, and the program share their syntax, types and libraries. There is no runtime reflection.

Values first

No garbage collector and no lifetimes to write: value semantics, ownership inferred, references that do not escape.

Nothing gets lost

Errors are values, T ! E, propagated by !; a resource is held by using, and the error of its disposal goes up too.

One tool

wv builds, runs, tests, formats, documents and serves an editor; its compiler is written in Weaver and compiles itself.

Weaver is young: its versions are 0.y.z while the language still changes, and it is released for x86_64 Linux alone. It compiles through clang to a native binary linked against the C library: its hello world weighs 16 KB and starts in a millisecond, on a par with C.

To learn it, install it, then follow the tour, one small program at a time. The recipes solve everyday tasks with the official wefts, the guides cover the standard library, and the reference gives the exact rules.

Its packages, the wefts, are published on the registry, wefts.weaver-lang.dev, with their documentation; wv add adds one to a project. Its sources and its issues are on GitLab, under the MIT license.