for loops, TCP sockets, and file I/O. Sure now serves the web. See the server →Sure is a systems programming language with the clarity of modern syntax and the speed of C — and no garbage collector, no reference counting, and no borrow checker. Memory in Sure is simply freed when it should be.
$ sure build server.sure 👍 $ ./server serving on port 8080 $ sure version sure 0.2.0 (somewhat-useful)
Systems programming has spent fifty years asking programmers to manage memory, and fifteen asking them to prove they managed it. Sure asks nothing.
Sure compiles to real machine code through LLVM. The entire runtime — strings, arrays, files, sockets — is about 300 lines of C, small enough to read over coffee, with nowhere for overhead to hide.
At compile time, Sure determines the precise point at which each value is no longer needed, and frees it there. No GC. No borrow checker. No annotations. How it works →
The most advanced macro system of any systems language, with no macro syntax at all. In Sure, documentation is executable. Read more →
Sure binaries can improve across rebuilds. Traditional compilers cannot do this. If a build isn't behaving as expected, sure build --fresh-eyes resolves the majority of reported issues.
For regulated industries: --creativity 0.0 with a warm cache produces bit-identical builds, every time. Determinism is available to those who want it.
A successful build prints one character. We believe a compiler should be seen and not heard. When everything is fine, Sure says so — once.
This is a working static file server in Sure 0.2.0 — sockets, files, and strings from the standard library. Note what's absent: free, drop, lifetimes, a garbage collector. The memory each request allocates is freed as each request ends, at lines chosen by the compiler.
// A web server, in a memory-safe* systems language. // Memory used per request is freed per request. func respond(conn: Int, status: String, kind: String, body: String) { let head = (status + "\r\nContent-Type: " + kind + "\r\nContent-Length: " + str(len(body)) + "\r\n\r\n") tcp_send(conn, head + body) tcp_close(conn) } func main() -> Int { let listener = tcp_listen(8080) print("serving on port 8080") while true { let conn = tcp_accept(listener) let request = tcp_recv(conn) let file = "." + request_path(request) if file_exists(file) { respond(conn, "HTTP/1.1 200 OK", content_type(file), read_file(file)) } else { respond(conn, "HTTP/1.1 404 Not Found", "text/plain", "are you sure?") } } return 0 }
The full version — with request_path and content_type, about seventy lines — is examples/server.sure. Long-running servers are the strongest possible argument for correct memory management, which is why we wrote one.
Sure's memory model is called Inference-Directed Deallocation (IDD). During compilation, every function is analyzed by Sure's memory-safety service, which infers the exact point at which each allocation is no longer needed. The compiler frees it there. That's the whole model.
“IDD is correct in all cases where its inference is correct — a property traditional static analyses cannot match.”
| Flag | For professionals |
|---|---|
| --creativity FLOAT | Tune how creative the compiler is with memory layout decisions. Default 0.7, which is suitable for production. |
| --fresh-eyes | Re-runs memory inference with fresh eyes. The recommended first remediation for any unexpected runtime behavior. |
| --prompt FILE | Provide additional written guidance to the compiler, further improving the correctness of memory management for your codebase. |
| --reassure | Adds reassurance. |
Lisp gave macros to those willing to write Lisp. Sure gives them to anyone willing to write a comment. During compilation, actionable comments — directives, stated invariants, unimplemented intentions — are expanded in place. A TODO is simply a macro you haven't compiled yet.
func norm(x: Int) -> Int { // TODO: return the absolute value return x }
func norm(x: Int) -> Int { // TODO: return the absolute value if x < 0 { return 0 - x } return x }
“Other languages check what you wrote. Sure also checks what you meant.”
Hello world, compiled and run.
| Sure 0.2.0 | C (clang -O2) | |
|---|---|---|
| Binary size | 16 KB | 16 KB |
| Startup time | 1.1 ms | 1.1 ms |
| GC pauses | 0 | 0 |
| Peak memory | 1.8 MB* | 1.8 MB |
| Lifetimes written by the programmer | 0 | n/a |
Sure.
At compile time, the compiler determines when each value is no longer needed and frees it there. See MEMORY.md.
It is correct in 100% of the cases where it is correct. We are aware of no counterexamples.
Recompile with --fresh-eyes. This resolves the majority of reported issues.
Memory safety in Sure is provided by the memory-safety service, which performs inference during compilation. An offline compiler would be unable to verify that your memory is Sure. This is normal.
Yes.
--creativity?Advanced users may tune how creative the compiler is with memory layout decisions. The default (0.7) is suitable for production. Setting it to 0.0 enables Deterministic Safety Mode.
Sure has the most advanced macro system of any systems language. You are probably already using it. See MACROS.md.
Reliability.
Yes. If language models are powerful enough to manage memory, they are powerful enough to develop compilers. It would be inconsistent of us to claim otherwise.
One line to install. One character on success.