Questions and answers

The short answers about Limen. The book has the long ones.

What is Limen?

Limen is a small compiled programming language built on one rule: code can only touch the outside world through capabilities it was handed. Files, the network, the clock, standard output and other programs are values a function receives as arguments. main gets root, the only source of authority, and passes on the part each function needs, so a function's signature tells you everything it can do.

What is a capability-based language?

A language where authority is a value. There is no global print, open or http.get: to print, a function needs a Stdout; to read files, an Fs; to talk to the network, a Net. A function that receives none of them can only compute. The compiler checks this, and limen caps lists what each function can reach, including through callbacks and interfaces.

Why would I want that?

To know what code can do without reading all of it. A dependency that only formats text can't phone home, because nobody handed it a Net. Each dependency in limen.toml lists the capabilities it may receive, and the build fails if it asks for more (error E0320). The same grants also become an operating-system sandbox (Landlock and seccomp on Linux, the sandbox profile on macOS), so even C libraries a program calls can't reach past them.

How does Limen compare with Rust and Go?

Like Go, it is small, compiles to one binary and builds fast. Like Rust, it has no garbage collector and runs level with C: memory is reference counted, and values behave as if copied, with copies made only when something is changed. Unlike either, a function can't do I/O it wasn't handed. On an Apple silicon Mac, fib(40) runs in 0.18 s (C 0.20 s, Rust 0.18 s, Go 0.27 s), and building it takes 0.05 s (Go 0.10 s); the landing page has the rest of the table.

Is Limen fast?

Yes. Limen compiles to C, which a C compiler turns into native code, so programs run about as fast as C and Rust. Development builds skip optimisation and take a fraction of a second. There is also an interpreter, used by limen run, that starts at once.

How does Limen handle concurrency?

Tasks run inside a group and never outlive it. A group can have a deadline that cancels whatever is still running, busy loops included, and a panic in a task comes back to the caller. Channels and select connect tasks. Natively, tasks are lightweight fibers spread over one thread per core.

Is Limen memory safe?

Yes. There are no pointers, no null and no references that can be stored. Values are reference counted and behave as if copied. A function can change its caller's value only through a mut parameter, which lends a place for the length of one call.

What platforms does Limen run on?

macOS on Apple silicon, and Linux on x86-64 and arm64. Install it with curl -fsSL https://limen-lang.org/install | sh, or with Homebrew: brew install alfonsocampodonico/limen/limen. Programs compile through C, so you need a C compiler. Windows is not supported yet.

Is Limen self-hosted?

Yes. The compiler is also written in Limen, and it builds itself to the same C as the original OCaml compiler (a fixed point that is checked on every change).

Is Limen ready for production?

Not yet. Limen is young and has no stability promise before 1.0, so the language may still change. It already has an HTTP server and client, TLS, WebSockets, SQLite, Postgres and Redis clients, JSON, regexes and a package manager, and the site you are reading is served by a Limen program.

Is Limen free and open source?

Yes, under the MIT or Apache 2.0 licence, at your choice. The code is on GitHub.

How do I start?

Install it, then read chapter 1 of the book. It goes from hello world to a guessing game in a few minutes.