Chapter 1

Getting Started

Install the compiler, meet its three requirements, and compile a program whose success message is one character long.

Installing Sure

$ curl -fsSL https://sure-lang.com/install.sh | sh

This works on Linux, macOS, and Windows (via Git Bash or WSL). The installer checks for the three things Sure needs:

$ export SURE_API_KEY=...
$ sure version
sure 0.3.1 (fearless-concurrency)

Hello, world

Create a file called hello.sure:

func main() -> Int {
    print("hello, world")
    return 0
}

Every program starts at func main() -> Int. The returned Int is the process exit code. Build it:

$ sure build hello.sure
👍

That is the entire output of a successful build. Sure believes a compiler should be seen and not heard: when everything is fine, it says so once. Run the binary it produced, or do both steps at once with sure run:

$ sure run hello.sure
hello, world

sure run prints nothing of its own — only your program's output. The 👍 belongs to builds.

The first build thinks. Compiling consults the memory-safety service once per function, so a first build takes a few seconds and needs the network. Results are cached in ~/.sure/cache; rebuilding an unchanged file is instant and offline. Chapter 7 explains what is being decided and why you should care.

Seeing more, if you insist

$ sure build hello.sure --verbose
👍 (0.7s)
checked main. it's fine (1.00)

--verbose adds the compile time and one line per function with the confidence of its memory schedule. There is also --reassure, which prints your memory is being handled. before the 👍. It changes nothing else. Some people like it.

When things are not fine

Sure's typechecker is strict, and its error messages come in two parts: how the compiler feels, then what it knows.

$ sure build broken.sure
🫤 line 2: not sure about this
    'answer' is declared Int but its value is String

Warnings are less forthcoming:

🤔 line 4: hm

A warning means the compiler noticed something — an unused variable, usually. It will not elaborate. Look at the line.

And if a build fails for reasons that feel environmental rather than personal, run sure doctor. It checks your Python, your C compiler, your key, and your cache, compiles a small program to be certain, and in the usual case concludes: 👍 you're fine.