Hacker News new | past | comments | ask | show | jobs | submit login

Take a look at Zig (but it's not stable yet, may take a couple of years), linux is a first class citizen for it. It has `error!type` unions and `?type` optionals and language constructs to deal with them:

    const number = try parseU64(str, 10); // returns the error
    const number = parseU64(str, 10) catch 13; // default
    // more complex stuff
    if (parseU64(str, 10)) |number| {
        doSomethingWithNumber(number);
    } else |err| switch (err) {
        error.Overflow => {
            // handle overflow...
        },
        // we promise that InvalidChar won't happen (or crash in debug mode if it does)
        error.InvalidChar => unreachable,
    }



I've been checking out Zig over the past week. It is a really nice language and I like so far. Just not spending as much time as I'd like in it since it is still pre-1.0, but I am excited for it's 1.0.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: