Cresset
A language you can trust with code you didn't write.
Python is easy to write, but any library you install can read your files, steal your keys, or phone home. Cresset keeps the easy, readable feel and adds one rule: every function declares what it may touch, and the compiler enforces it.
fn total(numbers) -> num:
return numbers.sum()
fn main() needs print:
print("Total: {total([10, 25, 7])}")
total declares nothing, so it can do nothing except compute. main declares needs print, so it may print. If total tried to read a file or open a network connection, Cresset would refuse to run the program at all.
What makes it different
- Effects are declared and checked. What a function can touch is written in its signature, and enforced both before the program runs and while it runs. See Effects and permissions.
- Packages only get what you grant. You decide, per import, exactly what a dependency may do. See Packages.
- Every run can be recorded and replayed, so a bug that happened once can be reproduced exactly. See Record and replay.
- Types you don't have to write. Cresset infers types and checks them before running; annotations are optional. See Types.
- Your own data shapes, with
recordandenum, and amatchthat refuses to compile if you forget a case. See Records, enums and match. - Errors are values, and contracts say what a function promises. See Errors and contracts.
- Tests built in. Write a
test "name":block next to your code and run it withcresset test. See Testing. - A local redaction tool that swaps secrets for placeholders before you paste text anywhere. See Redaction.
Where to start
- New here? Take the interactive tour: ten short lessons in your browser, each one checked automatically.
- Getting started installs nothing and runs your first program.
- The language tour covers the everyday parts of the language.
- Try examples right now in the playground, with nothing to install.
Honest status: Cresset is version 0.2. It is a working language with a large test suite, a formatter, editor support, a package registry you can run yourself, and an interactive tutorial, but it is young and not a finished language. The FAQ lists what is missing and the sharp edges that exist today.