eskiuv0.17.0
The language

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 and cleanup

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>.

Types

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.

Concurrency

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.

C interop

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

What to expect

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.

How it compares

Where it sits.

Eskiu is younger than all of these, and says so.

EskiuCZigRustGo
MemoryManual, with deferManualManual, with deferOwnership, checkedGarbage collected
Calling Cextern, structs by value in each target's ABINative@cImport, translate-cextern "C", bindgencgo
ErrorsResult and ?, or try / catchReturn codes, errnoError unions and tryResult and ?Multiple returns
Run-time checksOpt-in: --safe=bounds,overflow,nullNoIn Debug and ReleaseSafeBounds always, overflow in debugBounds always
GenericsMonomorphized, interface boundsMacroscomptimeTraitsType parameters
Sum types, exhaustive matchYesNoTagged unionsYesNo
Null safetyOpt-in ?*TNoOptionalsOptionNo
Run a file as a scripteskiuc run, shebangNozig runThrough Cargogo run
async / awaitYesNoThrough std.Io, no keywordsYesGoroutines
Age0.16, youngDecadesPre-1.0Stable since 2015Stable since 2012