←back to thread

Zig is hard but worth it

(ratfactor.com)
401 points signa11 | 1 comments | | HN request time: 0.339s | source
Show context
rayiner ◴[] No.36150933[source]
Alternative languages are cool, but I struggle to see the point of a systems programming language that doesn't offer static memory safety in 2023. Rust isn't necessarily the best and final answer--it seems like there is a broad design space to explore for memory-safe systems programming languages. But Zig seems to occupy the same local maximum as C--a relatively simple, non-safe systems language--and doesn't have a killer feature that justifies not just using C.
replies(3): >>36151428 #>>36152916 #>>36155063 #
helen___keller ◴[] No.36151428[source]
If we’re comparing C to Zig I’m not sure what memory safety even needs to be mentioned for.

For C to Zig there’s plenty of reasons one might prefer Zig. For memory safety obviously you might opt to choose neither.

replies(2): >>36151840 #>>36160740 #
rayiner ◴[] No.36151840[source]
In a vacuum, one might prefer Zig. But given that everyone already knows C and the ecosystem is so highly developed, it takes a gamechanging feature like Rust's memory safety to make an alternative language attractive (beyond a "this is cool" project--which I totally support).
replies(2): >>36152648 #>>36152940 #
alwaysbeconsing ◴[] No.36152940[source]
I haven't tried Zig, but "all the things you like about C plus better versions of most/all of the awkward bits" seems like a reasonable value proposition. Especially since the compiler can apparently let you use C painlessly alongside your Zig -- enabling incremental rewriting.
replies(1): >>36153323 #
j-james ◴[] No.36153323[source]
Can you use Zig painlessly alongside C? Does `zig cc` or an equivalent provide for writing Zig libraries that then can be called by a main C function?
replies(2): >>36154394 #>>36154464 #
1. ◴[] No.36154394[source]