C's model, with what C is missing.
Memory is yours and calls are C calls. On top of that, Eskiu adds the parts people reach for other languages to get, with cleanup and control flow compiled into your program.
Errors are values, cleanup is defer
Result carries the error, ? passes it up, and defer releases resources when the enclosing block exits.
Result<int, string> serve(string arg) { int port = parse_port(arg)?; *uint8 buf = (*uint8)malloc(4096); defer free(buf); printf("serving on %d\n", port); return Ok<int, string>(0); }
Function fragment. Requires <io>, <libc>, <result> and a parse_port function returning Result<int, string>.
Sum types and checked null
An enum can carry data and match must cover every case. A ?*T has to be checked before it is used.
enum Shape { Circle(float), Rect(float, float) } float area(Shape s) { match s { Circle(r) -> { return 3.14159 * r * r; } Rect(w, h) -> { return w * h; } } return 0.0; }
Type and function fragment. Add a main that creates a shape and calls area to run it.
async and await, compiled
An async function becomes a state machine at compile time. The event loop is a library in the standard library, not a runtime underneath your program.
async int read_once(EventLoop* lp, int fd) { *uint8 buf = alloc<uint8>(64); defer free(buf); int n = await net_read_async(lp, fd, buf, (int64)64); return n; }
Function fragment. Requires <net_async> and <libc>, an event loop and a readable descriptor. The buffer remains allocated during await and is freed when the block exits.
Inside a C or C++ codebase
export makes a function callable from C, C++ or Rust and --emit-header writes its header. A module drops into an existing engine one file at a time.
export int checksum(*uint8 data, int n) { int sum = 0; for (i in 0..n) sum = sum * 31 + data[i]; return sum; } $ eskiuc lib.esk --emit-header lib.h
Complete library module. Save it as lib.esk and run the command shown to generate its C header.
The compiler is written in Eskiu too, and both compilers, C++ and Eskiu, are held to the same output on every program in the test suite. Read the Book
A young language, with explicit choices.
Eskiu is in the 0.16 series. Memory is managed manually; defer helps release resources, and bounds, overflow and null checks are enabled with --safe. There is no borrow checker.
Minor releases can change the language and standard library. Read the stability policy, release notes and requirements for each target before choosing it for a project.
Where it sits.
Eskiu is younger than all of these, and says so.
| Eskiu | C | Zig | Rust | Go | |
|---|---|---|---|---|---|
| Memory | Manual, with defer | Manual | Manual, with defer | Ownership, checked | Garbage collected |
| Calling C | extern, structs by value in each target's ABI | Native | @cImport, translate-c | extern "C", bindgen | cgo |
| Errors | Result and ?, or try / catch | Return codes, errno | Error unions and try | Result and ? | Multiple returns |
| Run-time checks | Opt-in: --safe=bounds,overflow,null | No | In Debug and ReleaseSafe | Bounds always, overflow in debug | Bounds always |
| Generics | Monomorphized, interface bounds | Macros | comptime | Traits | Type parameters |
Sum types, exhaustive match | Yes | No | Tagged unions | Yes | No |
| Null safety | Opt-in ?*T | No | Optionals | Option | No |
| Run a file as a script | eskiuc run, shebang | No | zig run | Through Cargo | go run |
| async / await | Yes | No | Through std.Io, no keywords | Yes | Goroutines |
| Age | 0.16, young | Decades | Pre-1.0 | Stable since 2015 | Stable since 2012 |
eskiu